Introduction to R and the tidyverse

Due by 11:59 PM on Monday, June 12, 2023

Task 1: Make an RStudio Project

  1. Use either Posit.cloud or RStudio on your computer (preferably RStudio on your computer! Follow these instructions to get started!) to create a new RStudio Project.

  2. Create a folder named “data” in the project folder you just made.

  3. Download this CSV file and place it in that folder:

  4. In RStudio, go to “File” > “New File…” > “R Markdown…” and click “OK” in the dialog without changing anything.

  5. Delete all the placeholder text in that new file and replace it with this:

    ---
    title: "Exercise 1"
    author: "Put your name here"
    ---
    
    # Reflection
    
    Replace this text with your reflection
    
    
    # My first plot
    
    ```{r load-libraries-data, warning=FALSE, message=FALSE}
    library(tidyverse)
    
    cars <- read_csv("data/cars.csv")
    ```
    
    Replace this line with a code chunk and use it to create a plot.
  6. Save the R Markdown file with some sort of name (without any spaces!)

  7. Your project folder should look something like this:

Task 2: Make an R Markdown file with a plot in it

  1. Add your reading reflection to the appropriate place in the R Markdown file. You can type directly in RStudio if you want (though there’s no spell checker), or you can type it in Word or Google Docs and then paste it into RStudio.

  2. Remove the text that says “Replace this line with a code chunk” and insert a new R code chunk. Either type ctrl + alt + i on Windows, or + + i on macOS, or use the “Insert Chunk” menu:

  3. Use ggplot() to create a scatterplot using the cars dataset. Use whatever variables you want. Type the code to create the plot in the new empty chunk.

  4. Knit your document as a Word file (or PDF if you’re brave and installed LaTeX). Use the “Knit” menu:

  5. Upload the knitted document to iCollege.

  6. 🎉 Party! 🎉

File organization

You’ll be doing this same process for all your future exercises. Each exercise will involve an R Markdown file. You can either create a new RStudio Project directory for all your work:

Or you can create individual projects for each assignment and mini-project: