Technology Course Day 2: R and RStudio

Installation

  • Install R software from CRAN

  • Install RStudio

  • Andrew Heiss has on his blog install instructions for both Windows and OS X

Set-up

  1. Set your CRAN mirror: preferences > packages

  2. Set your theme and font: preferences > appearance

  3. Set your pane layout: preferences > Pane Layout

  4. In preferences > General, verify “save workspace on exit” set to NEVER

Packages and Libraries

Try installing the dplyr package:

install.packages("dplyr")
  • There is also a drop-down menu under Tools > Install Packages

Load the dplyr package from your computer into your RStudio workspace:

library(dplyr)

Getting Help for a package

Help file:

help(foo)
?foo ## ?? double question marks needed if package isn't loaded into library

Vignettes:

vignette() # this will show list of all vignettes
vignette(package = "dplyr") # vignettes included for a specific package
vignette("dplyr") # views vignette

Books and other resources

  • We will be following R for Data Science (abbreviated R4DS) which is free online but you can also buy the book if you prefer

  • Library has another good resources: Hands-on programming with R Garrett Grolemund

The tidyverse

We will be using a lot of packages in the tidyverse. Install or check for updates:

install.packages("tidyverse")
tidyverse_update()

Additional packages used in the R4DS book:

install.packages(c("nycflights13", "gapminder", "Lahman"))
Avatar
Elisha Cohen
Data Science Faculty Fellow

I am a Data Science Faculty Fellow at NYU’s Center for Data Science. I work at the intersection of political methodology, applied statistics and data science.