Suggestion Box
Spot an error or have suggestions for improvement on these notes? Let us know!
Installing & Introducing R and RStudio
R is a free, open-source statistical programming language used widely in academia, research, and industry.
It’s designed for data analysis, visualization, and reproducible workflows, and it integrates seamlessly with RStudio, an IDE that makes working with R easier.
Installing R and RStudio
Step 1 – Install R
- Go to https://cran.r-project.org.
- Choose your operating system (Windows, macOS, or Linux).
- Download the most recent release (e.g.,
R-4.x.x). - Run the installer and accept the default options.
- On macOS, drag R to Applications.
- On Windows, use all default settings.
After installation, you’ll have a base R application, which provides the core language and console.
Step 2 – Install RStudio Desktop
- Visit https://posit.co/download/rstudio-desktop/.
- Download the free RStudio Desktop version (Posit is the company behind RStudio).
- Install using all default options.
RStudio does not replace R — it’s a graphical interface that runs R for you.
If you uninstall R, RStudio will not work.
Verifying Your Installation
Open RStudio.
At the bottom-left console prompt (>), type:
version
If installed correctly, you’ll see something like:
platform x86_64-apple-darwin20
R version 4.4.1 (2024-06-14)
You can also test by typing:
2 + 2
The console should return:
[1] 4
Understanding How R and RStudio Work Together
- R is the engine — it runs your code, performs calculations, and loads packages.
- RStudio is the dashboard — it makes using R more intuitive wiht a graphical user interface (GUI) and provides panes for your scripts, output, plots, and files.
You can think of this like JavaScript and VS Code:
- R ↔ JavaScript
- RStudio ↔ VS Code
RStudio manages projects, scripts, and visual outputs the way VS Code manages HTML and JS files.