Problem set 1
Due by 11:59 PM on Wednesday, September 11, 2019
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 :).
Instructions
Make a copy of the project named “Problem Set 1” on RStudio.cloud. If you don’t have access to the class RStudio.cloud account, please let me know as soon as possible. This link should theoretically 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
:problem-set-1.zip
. You’ll need to make sure you have these packages installed on your computer:tidyverse
,gapminder
, andbabynames
. If you try to load one of those packages withlibrary(tidyverse)
orlibrary(babynames)
, etc., and R gives an error that the package is missing, use the “Packages” panel in RStudio to install it.
- Alternatively, if you’re using R on your own computer, download this file, unzip it, and double click on the file named
Rename the R Markdown file named
your-name_problem-set-1.Rmd
to something that matches your name and open it in RStudio.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 HERE
s. Type your answers there.)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:
- Getting started with RStudio
- Introduction
- How it Works
- Code Chunks
- Inline Code
- Markdown Basics The R Markdown Reference Guide is super useful here.
- Output Formats
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.