Before class

Hello! Today we'll be going through some hands-on activities to help you get familiar with the R programming language and working with your data in RStudio.

First of all, before class, it is important that you have R and RStudio installed and are able to open RStudio. These are two programs necessary for our workshop. We'll get into their details later, but for now know that R is the programming language and RStudio is the development environment from which we will run R commands.

Note that R and RStudio are different programs and need to be installed separately, with R being installed first

Installing R

Please follow the instructions on this page to install R.

To begin, click the link for your operating system to bring up a list of files to download.

For Windows you will want to download the base install files.

For Macs, the file you download will depend on the processor in your computer.

  • If you have an M1 Mac or higher, you will want the file R-4.2.2-arm64.pkg
  • If you have an Intel Mac, you will want the file R-4.2.2.pkg

For Linux, please download the package appropriate for your distro.

After you have downloaded the file appropriate for your operating system, navigate to them and install the program as you would any other program on your computer.

Installing RStudio

Please follow the instructions on this page to install RStudio.

On the Rstudio install page, scroll down and select the file appropriate for your operating system and click to download.

After you have downloaded the file appropriate for your operating system, navigate to them and install the program as you would any other program on your computer.

If you have any trouble installing these programs, or experience any errors that prevent you from completing the installation, please let us know before class by replying to the email that you got with information about this workshop.

Opening RStudio

Once you have both R and RStudio installed, navigate to the RStudio program on your computer and open the program. This should open an interface that looks something like this:

Figure 1.1: A fresh RStudio session with no script open

If you have any trouble opening RStudio, or experience any errors that prevent you from opening the program, please let us know before class by replying to the email that you got with information about this workshop.

Installing Packages

For Days 2-4, we will use several packages that may not already be installed in your RStudio environment. You can try to install them before class to troubleshoot any issues or get help beforehand. Otherwise, we will walk you through installing them in class. If you already have these packages installed, it may be beneficial to make sure they are updated to the latest version.

In general, packages can be installed from the Packages tab in the RStudio panel in the lower right hand corner (default location). Once you click on this tab, you will see a list of packages already installed in your RStudio environment. To INSTALL a new package, click the "Install" button on the top left corner of the panel and search for the package name. To UPDATE an already installed package, click the "Update" button, also on the top of the panel, and again search for the package name.

Package Requirements by workshop day

Part 1 (Day 1)

  • No package requirements

Part 2 (Days 2 & 3)

Part 3 (Days 3 & 4)

Package Installation - Common Problems

Installing packages can be fraught with problems because everyone has different versions of things on their own computer. We are happy to help troubleshoot with you on the day of the workshop. If you experience problems installing packages before class, try to come a few minutes early for help. Otherwise, we will help you as best we can during the workshop.

Some common problems you may encounter:

  1. The rlang package is a dependency for many other packages and cannot be updated from within RStudio since it is always in use. To update this package, open the R interface (NOT RStudio) and use the update.packages() command. Again we will be happy to help with this if it is an issue.
  2. On Windows machines, you may be prompted to install the RTools dependency. Note that in most cases this can be ignored since we are using common packages that don't need to be built from source. But on the off-chance this needs to be installed it is done OUTSIDE of RStudio. We will be happy to help with this if it is an issue.
Accessing workshops

Click the link(s) below to download each day's workshop.

Once the .Rmd file is downloaded, open the file in RStudio

These links will become available as the date of the workshop approaches.