5 now draw the rest of the owl

Fig 5.1: Draw the rest of the owl.

There are many sources for learning the basics of R. A few of these follow. Please spend at least 90 mins exploring at least two of the following. Be prepared to discuss your progress next class (you will be asked which source(s) you used, what you struggled with, and whether you would recommend it to your classmates. (Note that all of these are free, though you may choose to make a donation to the author if you use the Peng text).

Hint: If you find the material too challenging - if you feel like you are drawing the rest of the owl - take a break away from your machine and other screens, clear your head, then try a different approach.

5.1 Review the RStudio cloud primers

A series of up-to-date, interactive tutorials may be found for working with RStudio.cloud here. There are two basic tutorials - one on data visualization, the other on programming.

5.2 Play with RStudio on your laptop

Last week, we began exploring Mine Çetinkaya-Rundel’s movies dataset in RStudio.cloud. Were you successful in getting this to run on your laptop as well?

5.2.1 Create a new R Markdown document and knit it to a PDF or a Word doc

In literate programming, comments, code, and results are integrated in a clear and reproducible way - they document our work. R markdown is built around this idea. To create an R markdown (Rmd) document in Rstudio (on your laptop) or Rstudio.cloud, begin with (File -> New File -> R Markdown). A window will open up with a file that begins with some YAML (Yet Another Markdown Language). You can edit this as needed:

---
title: "Your movies in R Markdown Document"
author: "Frankie McFrank Frank"
date: "1/27/2020"
output: html_document
---

Go ahead and click on the clever “knit” icon in the bar just above the source window to create a sample document. You’ll need to save the file with a new name, then R will finally create an HTML (Hyper Text Markdown Language - see the pattern?) page. Compare the R Markdown document (your code) with the result (the HTML). Now, try to knit the document into different output formats (click on the down arrow next to knit, and see if you can knit to PDF and Word). It may take a while the first time you do this, as you may need to load some additional formatting tools or packages (e.g., TinyTex) to successfully render these files.

Can you knit directly to a PDF document on your laptop? A Word document? If you struggle, you are not alone here - an advantage of RStudio.cloud over RStudio on the desktop is that, on your own machine, you may run into system-specific problems associated with the pandoc document converter.

If, after spending 15 minutes on this problem, you cannot knit directly to a PDF, stop and think about the problem.

5.2.2 Play with and explore the movies data

Iain Carmichael used these data to introduce R for his students several years ago; you may wish to use his code as a starting point. Continue to ask interesting questions about the data - can you see any way in which movies appear to have changed over time? What does “spilled” mean? Write up your results as an R markdown document.

5.3 Take a DataCamp class

Many folks swear by (and others, I presume, at) DataCamp, which kind of gamifies learning software. As a student in this class, you have access to all of their stuff… free. You can even do lessons on your phone. Use the link given to you in class to enroll.

5.4 Swirl (Swirlstats)

I, like thousands of others, learned R in the process of completing the Johns Hopkins Data Science Specialization offered through Coursera. The sequence can be challenging, but their introduction to R used an accessible, interactive R package called Swirl. You can read about swirl (“learn R in R”) at https://swirlstats.com/.

Using Swirl. After loading R (and opening R studio), you will get to the Swirl lessons with the following steps:

  1. Install the Swirl package on your computer (you only need to do this once). Type the following into your console window in R studio (typically left hand side of your screen or lower left)

install.packages(“swirl”)

  1. Then load the package into your workspace (you’ll need to do this at the beginning of every session you use Swirl)

library (swirl)

  1. Then run it!

swirl ()

Swirl will ask a few questions then give you the option of choosing one of several courses. You’ll choose the R Programming option, which leads to 15 separate lessons.

At the end of each lesson, you’ll be asked

Would you like to receive credit for completing this course on Coursera.org?

Answer no… then do another lesson.

5.5 Read Peng’s text and/or watch the associated videos

Finally, consider the text and videos from the Coursera R class. Most of the material from that class can be found in the Peng text (2014). A slightly updated version of the text can be found at https://bookdown.org/rdpeng/rprogdatascience/, and the videos in the series may be found by clicking on the following:

Roger Peng.

Video 5.2: Roger Peng introducing R

5.6 Code along with a tidy webinar, or attend a virtual conference

Among these resources for R studio beginners, you will find Thomas Mock’s introduction to Tidy statistics in R. It includes a link to the code used in the seminar at the bottom of the launch screen.

The second chapter of Healy’s online book about Data visualizations provides an introduction to R and R studio which largely parallels the discussions here and in the Wickham and Grolemund text (Healy 2017; Wickham and Grolemund 2016)

The Grolemund video linked in the prior chapter is part of a series of videos on programming in RStudio. It’s a little out of date now (from 2015), but still likely to be useful.

Most of the offerings at the Rstudio::global conference are aimed at more experienced R users, some are aimed at (relative) noobs, including Learning R with Humorous Side Projects. The 2021 conference, to be held on January 21, 2021, is free; you can enroll and explore here

5.7 Something else

The “something else” category includes Datacarpentry.org, which is aimed at fostering data literacy and provides free lessons for learning and applying R in areas such as Ecology, Genomics and Geospatial data analysis. Of particular interest are the social science lessons, as well as a workshop in data science based on the "Studying African Farmer-led Irrigation (SAFI)" dataset.

References

Healy, Kieran. 2017. “Data Visualization for Social Science: A Practical Introduction with r and Ggplot2.”
Peng, Roger D. 2014. R Programming for Data Science.
Wickham, Hadley, and Garrett Grolemund. 2016. R for Data Science: Import, Tidy, Transform, Visualize, and Model Data. " O’Reilly Media, Inc.".