← Back to Module 0: Languages & Platforms

RStudio Interface Guide

~30 min For R users

RStudio is the most popular IDE (Integrated Development Environment) for R. It's free, powerful, and designed specifically for statistical analysis and research. If you'll be using R for this course, this is where you'll spend most of your time.

What is RStudio?

RStudio is not the R language itself—it's a program that makes writing R code much easier. Think of it like this: R is the engine, and RStudio is the car with the steering wheel, dashboard, and comfortable seats. You could drive the engine directly (by running R in a terminal), but RStudio makes the experience much more pleasant.

Installing RStudio

Before installing RStudio, you need to install R itself. Here's the order:

  1. Install R first: Download from cran.r-project.org
  2. Then install RStudio: Download from posit.co/download/rstudio-desktop
Why Two Installations?

RStudio needs R to function—it's just a nice interface around R. If you try to run RStudio without R installed, it won't work. Always install R first, then RStudio.

The RStudio Interface

When you first open RStudio, you'll see a window divided into four panels. Hover over each numbered region below to learn what it does:

Source
# Load packages
library(tidyverse)
library(fixest)

# Load data
df <- read_csv("data.csv")
1
Environment
df   1000 obs. of 5 variables
model1   List of 12
2
Console
> summary(df$income)
Min. 1st Qu. Median Mean 3rd Qu. Max.
15000 35000 52000 58400 75000 250000
> |
3
Plots Files Packages Help
[Plot appears here]
4

Hover over a numbered region to learn about that part of RStudio.

Essential Keyboard Shortcuts

Learning these shortcuts will dramatically speed up your workflow:

Shortcut (Windows/Linux) Shortcut (Mac) Action
Ctrl + Enter Cmd + Enter Run current line or selection
Ctrl + Shift + Enter Cmd + Shift + Enter Run entire script
Ctrl + L Cmd + L Clear the Console
Tab Tab Autocomplete function/variable names
Ctrl + Shift + C Cmd + Shift + C Comment/uncomment selected lines
Ctrl + S Cmd + S Save current file

Your First R Script

Let's write a simple script to make sure everything is working. In RStudio:

  1. Go to File > New File > R Script (or press Ctrl+Shift+N)
  2. Type the following code in the Source Editor:
# My first R script
# This is a comment - R ignores lines starting with #

# Print a message
print("Hello, RStudio!")

# Create some data
x <- c(1, 2, 3, 4, 5)
y <- x * 2

# Calculate the mean
mean(y)

# Create a simple plot
plot(x, y, main = "My First Plot")
  1. Place your cursor on the first line and press Ctrl+Enter repeatedly to run each line
  2. Watch the output appear in the Console, and the plot appear in the Plots panel

Cloud Alternative: Posit Cloud

If you don't want to install anything, you can use Posit Cloud (formerly RStudio Cloud) in your browser. It's the same RStudio interface, running in the cloud.

Try Posit Cloud (Free) →

Video Tutorial

Recommended: Official RStudio Tutorial

For a visual walkthrough of the RStudio interface, I recommend this official video from Posit: