1  Setup

1.1 Objectives

  • Get your RStudio environment set up

1.2 Accessing RStudio

The best way to write R code is in the RStudio editor, which is a free product created by a company called Posit. You can either install R and RStudio on your computer, or access RStudio in web browser using a free Posit Cloud account

1.2.1 Install on your computer

To install R and RStudio on your computer, follow the instructions here. Be sure to install R first, and then install RStudio. You will never need to open the R installation because RStudio automatically finds your R installation.

1.2.2 Posit Cloud (web browser)

Posit Cloud works in the browser with a free account. You can make an account and get started here. This option is recommended for those who regularly use different computers for their work.

1.3 Accessing Code Files

It is recommended that you follow along by typing out code or copying and pasting from this workshop site, but some may want the full code files for reference. Below are instructions for multiple ways to get those.

1.3.1 Section by Section

Each section of this workshop contains the code for that page under Code Links in the right sidebar. When you click on the file name, it will download the file to your computer for use.

1.3.2 GitHub

All of the code files are available in this GitHub repository.

  1. From the Terminal tab in RStudio in the bottom left panel, type these commands:
git clone https://github.com/SouthernMethodistUniversity/intro-to-r.git
cd intro-to-r/code/
  1. Navigate to the intro-to-r/code/ directory in the Files tab on the bottom left panel in RStudio

  2. Click on More > Set As Working Directory

  1. Go to github.com/SouthernMethodistUniversity/intro-to-r

  2. Download the folder by going to Code > Download ZIP

  3. Navigate to the intro-to-r/code/ directory in the Files tab on the bottom left panel in RStudio

  4. Click on More > Set As Working Directory