Introduction to R, RStudio, R Markdown


Let’s get coding!


Time Estimates:
     Videos: 30 min
     Readings: 60 min
     Activities: 90 min
     Check-ins: 2



Introduction to R


Required Video: Introduction to R




Basics of Visualization


Required Tutorial: Primer: Basics of Visualization in R


After working through the tutorial, if you feel more detail would be helpful, consider the following readings:


Extra Resources:

Basics of R Programming


Required Tutorial: Primer: Basics of Programming in R




Check-In 1: Basics of R


Question 1: What does it mean for R to be “open-source”?

  1. Users are required to share all the code they write.
  2. Private companies must pay the R Core Group to use R.
  3. Developers cannot charge for the use of their R software.
  4. Anyone can change the base functionality of R.

Question 2: Identify the elements of the following plot as

  1. The aesthetic
  2. The geometry
  3. The scales
  4. None of the above

  1. The x-axis is age
  2. The y-axis is “Urge to run up the down escalator”
  3. The y-axis ranges from “Weak” to “Strong”
  4. This is a line graph
  5. The two lines are “What I was supposed to feel” and “What I’ve actually felt”
  6. The lines are labeled with text
  7. Only even ages are labeled
  8. Stick figure people are sliding down the line

Introduction to RStudio


Required Video: Introduction to RStudio




Required Reading: A tour of RStudio




Extra Resources:
  • Click Here to download a “cheatsheet” (easy reference page) for RStudio.

  • Here is another walkthrough video for touring RStudio.


Installing R and RStudio


Install R

If you already have R downloaded, please follow these steps anyways, to make sure you have the most recent version of R.

Download and install R by going to https://cloud.r-project.org/.

If you are a Windows user:

  • Click on “Download R for Windows”

  • Click on “base”

  • Click on the Download link.

If you are a Linux user:

Click on “Download R for Linux” and choose your distribution for more information on installing R for your setup.

If you are macOS user:

  • Click on “Download R for (Mac) OS X”

  • Under “Latest release:” click on R-X.X.X.pkg, where R-X.X.X is the version number. For example, the latest version of R as of June 22, 2020 was R-4.1.0.

Troubleshooting for Macs

First, identify which version of OSx you are running. How-to

Next, find out which version of R your computer can run. Link

If this version is 3.5 or later, download the latest version that your computer can handle.

If this version is 3.4 or earlier, you’re going to run in to some trouble. I recommend updating your version of OSx, if you are willing. If you can’t, then you can use rstudio.cloud to run R and RStudio on a free server. However, I recommend strongly against this option; your files will not be saved indefinitely, your computing power will be limited, and you will need an internet connection at all times to do your work.


Install RStudio

RStudio can be downloaded here

If you already have RStudio:

You do not need an update if your RStudio logo looks like this:

You do need an update if your RStudio logo looks like this:


Install/update the tidyverse

In this class, we will make heavy use of the tidyverse suite of packages.

If you have not used the tidyverse before, type the following into your console:

install.packages("tidyverse")

If you have used the tidyverse before, you only need to update packages.
Type the following into your console:

library(tidyverse)
tidyverse_update()

Then follow the instructions that print out to update a few of your tidyverse packages.


Introduction to R Markdown


Required Video: Introduction to R Markdown




Required Reading: Intro to R Markdown




Extra Resources:
  • Click Here to download a cheatsheet for R Markdown.

  • This page has some tips for making your R Markdown documents more beautiful. —

Bringing it all together


Check-In 2: R, RStudio, and R Markdown


Correct the following sentences, so that they make sense.

  1. “I wrote RStudio code to make a beautiful plot.”

  2. “I used Markdown to put R code in my report.”

  3. “I can’t get R to open!”

  4. “Can I send you my RStudio so you can check out if my R Markdown code is correct? I can’t get R to knit.”