We will be doing a lot of work in this class using two related pieces of software. The first is R, a widely-used programming language designed for statistical computing. The second is RStudio, an integrated development environment, or IDE, for R. Think of R as being a little like the parts of a car that do the work of moving around: the engine, transmission, wheels, brakes, and so on. Think of RStudio as being like the driver’s seat and dashboard where you control those pieces of the car.
These notes describe how to download and install R and RStudio on your laptop, as well as how to install some additional stuff inside of R that we’ll be using also.
Once R and RStudio are installed, launch RStudio. Then, either carefully type in or (better) copy-and-paste the following lines of code at R’s command prompt, located in the RStudio window named “Console”, and then hit return. In the code below, the
<- arrow is made up of two keystrokes, first < and then the short dash or minus symbol, -.
## Code to run at the RStudio console begins here my_packages <- c("tidyverse", "broom", "coefplot", "cowplot", "drat", "gapminder", "GGally", "ggforce", "ggrepel", "ggraph", "ggridges", "graphlayouts", "here", "margins", "maps", "mapproj", "mapdata", "MASS", "naniar", "patchwork", "prismatic", "quantreg", "remotes", "scales", "sf", "socviz", "survey", "srvyr", "tidygraph", "viridis", "viridisLite") install.packages(my_packages, repos = "http://cran.rstudio.com") data_packages <- c("covdata", "congress", "demog", "uscenpops", "kjhnet", "nycdogs") drat::addRepo("kjhealy") install.packages(data_packages) ## Code to run ends here
This code will take a little while to run. Let me know in the Slack (in #general) if you have any problems.
If you do not have one already, it will be useful to create a GitHub account and obtain a GitHub Personal Access Token. This is not required for the course, it will just be helpful to have one. The process is a little tedious, but to get set up, read and carefully follow the instructions in Parts I and II of Happy Git With R, and then also the instructions in Appendix B of the same document.