Setup and Introduction
Required content
- Lecture: Course Introduction (see below)
- Install R and RStudio (see below).
- Create an Posit Cloud account (a free acount is fine!) and join the course workspace. (see below)
- R For Data Science: Introduction
- STATS 545: R Basics
Suggested content
- Install suggested tools (see below)
- Hands-On Programming with R: The Very Basics
- Posit Recipes
Install the software you need
For this course, we need to install R, RStudio, and the packages we’ll be using. This is a three step process!
Check out STAT 545: Install for more guidance.
Note: There are two types of installations for Mac users based on the type of processor chip you have: Intel or ARM (M* chips, like M1, M2, or M3) Check “About this Mac” on your computer and look for the Chip information. If you have an Intel chip, install the Intel 64-bit build; if you have an M* chip such as M1, M2, or M3, install the Apple silicon arm64 build.
- Install the latest version of RStudio
- Follow the instructions below to install all the packages we will be using in the course
Open RStudio and run this code in the console. NOTE: R may ask you to install source packages instead of binaries. (Do you want to install from sources the packages which need compilation? (Yes/no/cancel)
. Say “no” for now. We’ll circle back to what this means later.
options(repos = "https://cran.rstudio.com/")
install.packages("remotes")
remotes::install_github("malcolmbarrett/masterepir")
This will take some time as many packages will be downloaded. When complete, you’ll see DONE (masterepir)
displayed in the console.
NOTE: You may encounter an error trying to install certain packages that require additional software. A common source of such errors is needing Rtools on Windows or xcode on Mac. Read more here on how to set these up on your local computer: https://r-pkgs.org/setup.html#setup-tools
Set up an Posit Cloud account
We’ll also be using Posit Cloud. Sign up for a free account. Then join the Posit Cloud course workspace (click on the Cloud icon at the top of the page). The Posit Cloud workspace will have all the R packages and course material you need. In other words, the course material will just work here without you having to do any setup! If you are having trouble with your local setup, we highly recommend just using this workspace.
Important: Please turn in all your assignments on Posit Cloud, even if you’re working on your local computer. For assignments, you don’t need to do anything to “submit.” We will have access to the most recent state of your assignment.
For grading, it’s critical that we can run your assignment. Make sure you restart your R session often while working (In RStudio, go to Session > Restart R
) and re-run your code so you know it’s working properly. See “Start R with a Blank Slate” for more information.
Install suggested tools
I also recommend you do some additional setup on your local computer for future use. Note: These are already set up on Posit Cloud, so you don’t need to do anything there.
- Install tinytex to use PDF output in Quarto
install.packages("tinytex")
tinytex::install_tinytex()
Some Mac users see an error along the lines of /usr/local/bin not writable
when installing TinyTex. Follow these instructions if you encounter this error.
- Set up a blank slate for RStudio sessions (this helps with reproducibility)
install.packages("usethis")
usethis::use_blank_slate()
- Set ragg as your graphics device for RStudio. This will improve your data visualization output in the RStudio viewer, particularly on Windows.
install.packages("ragg")
After installing ragg, set it as the backend for RStudio: Tools > Global Options > General > Graphics > Backend > AGG
Lecture: Course Introduction
Videos for each section of the lecture are available at this YouTube playlist.
You can also watch the playlist (and skip around to different sections) here: