Set Up RStudio

Install the software and open the starter project

Install R and RStudio, unzip the starter files, and identify the four RStudio panes.

R performs the statistical calculations. RStudio gives you a place to write code, run scripts, inspect data, and view graphs. You need both programs.

Install R And RStudio

Install the programs in this order:

  1. Download and install R.
  2. Download and install RStudio Desktop.
  3. Open RStudio once both installations are complete.

For a more complete tour, including current download links, see Posit’s Get Started guide.

Download And Unzip The Starter Files

Download the starter files.

The file arrives as a compressed .zip folder. Extract its contents before opening the project:

Move the unzipped folder somewhere easy to find, such as your Documents folder. Keep all files and folders inside it together.

Open The Project

ImportantOpen the project before a script

Begin each work session by opening exploring-statistics-r.Rproj. Opening the project first helps R find the data and scripts used in the workbook.

  1. Open RStudio.
  2. Choose File > Open Project….
  3. Select exploring-statistics-r.Rproj inside the unzipped starter folder.
  4. In the Output pane, select the Files tab.
  5. Confirm that you can see folders named data, resources, and scripts.

Find Your Way Around RStudio

Screenshot of RStudio divided into four labeled panes. Source is at the upper left, Console is at the lower left, Environment is at the upper right, and Output is at the lower right.
Figure 1: RStudio interface with labels for the Source, Console, Environment, and Output panes.
Pane What you do there
Source Read, edit, and run .R scripts.
Console See commands run, messages, and printed results.
Environment See the objects currently available in R.
Output (Files, Plots, Packages, Help, Viewer) Browse files, view graphs, review packages, read help, and preview output.

You do not need to remember every tab. Most workbook activities use the Source pane, Console, Environment, and the Files and Plots tabs in the Output pane.

Check Your Setup

Before continuing, confirm that:

  • RStudio is open;
  • the project name appears in the RStudio window;
  • the Files tab shows the data and scripts folders; and
  • you have not opened a second copy of the starter folder from inside the .zip file.

Next, use Run Your First Script to check the data and learn how RStudio responds when you run code.