Problem set 1

Due by 11:59 PM on Wednesday, January 22, 2020

IMPORTANT: This looks like a lot of work, but I’ve provided the majority of the code. Most of the time you’ll just be running or modifying pre-written code chunks that are already there. Remember that you can run an entire chunk by clicking on the green play arrow in the top right corner of the chunk. You can also run lines of code line-by-line if you place your cursor on some R code and press “⌘ + enter” (for macOS users) or “ctrl + enter” (for Windows users).

Make sure you run each chunk sequentially. If you run a chunk in the middle of the document without running previous ones, it might not work, since previous chunks might do things that later chunks depend on.

Remember, if you’re struggling, please talk to me. Work with classmates too. Don’t suffer in silence! I promise that once you get the hang of this basic R coding stuff, the rest of the semester should go smoothly, and I promise that you can get the hang of this basic R coding stuff :).


  1. Make a copy of the project named “Problem Set 1” on If you don’t have access to the class account, please let me know as soon as possible. This link should take you to the project—if it doesn’t, log in and look for the project named “Problem Set 1.”

    Alternatively, if you’re using R on your own computer, download this file, unzip it, and double click on the file named problem-set-1.Rproj:

    You’ll need to make sure you have these packages installed on your computer: tidyverse, gapminder, and babynames. If you try to load one of those packages with library(tidyverse) or library(babynames), etc., and R gives an error that the package is missing, use the “Packages” panel in RStudio to install it.

  2. Rename the R Markdown file named your-name_problem-set-1.Rmd to something that matches your name and open it in RStudio.

  3. Complete the tasks given in the R Markdown file. Fill out code in the empty chunks provided (you can definitely copy, paste, and adapt from other code in the document—don’t try to write everything from scratch!), and replace text in ALL CAPS with your own. (i.e. You’ll see a bunch of TYPE YOUR ANSWER HEREs. Type your answers there). You don’t need to type in ALL CAPS though.

  4. When you’re all done, click on the “Knit” button at the top of the editing window and create a PDF or Word document of your problem set. Upload that file to iCollege.

Extra instructions

For Task 1 you should look through these videos and tutorials:

For Task 3, you’ll read through Chapter 3 of R for Data Science and complete the following exercises. I’ve included all the questions and most of the code in the problem set itself.