Intro to R and RStudio
NICAR 2018 Session on Saturday March 10, 9 am
This repo includes R scripts that will be on laptops in my NICAR hands-on session Saturday morning introducing R and RStudio.
I can't predict how many people might show up to a repeat session early on a Saturday morning :-) But if you know that you might want to attend and are worried that you may end up in the room but not at a session laptop, I figured I'd post the files in advance. So, if you are interested in setting up your own laptops in advance for the session, here's how. (Note: You probably want to do this sometime before the session starts, given the vagaries of hotel Internet connections.)
Download R from https://cran.rstudio.com/, choosing the binary distribution for your operating system. Install it as you would any other software program.
Download the free, open-source version of RStudio Desktop (not server) from the RStudio website. Install it as you would any other software program.
Open RStudio. Type the following line of code in the bottom left panel at the
>prompt (it may just be one large panel at the left instead of a top and bottom):
and hit return or enter. This installs an external R library called pacman that's useful for installing other packages.
- When that finishes, type the following line of code at the
and hit return or enter. As you might have guessed, that installs an external R library called usethis.
- When that finishes, type (or cut and paste) this code at the
This should download all the session files to your local system, and create a new project for them within RStudio. You'll be asked if you want to proceed with the download (choose yes) and whether you want to subsequently delete the zip file after it's unzipped (you probably do).
RStudio should now open in the directory containing your new project files. If it hasn't, find the IntroToR.Rproj file and click to open that.
- At the
>prompt in your lower left pane, type:
and hit return or enter. That should load all the other R packages you need for the session.