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
PhD Student in Political Science

I am a PhD student in political science at Emory University. I study political methodology with applications focused on gender, race, and inequality in the United States.