Installing R & RStudio

By the end of this lesson you'll have R - the language statisticians and biologists reach for - plus RStudio, the friendly workspace that makes it a pleasure to use.

🟒 Beginner ⏱️ ~30 min πŸ“Š R πŸ’» Windows Β· macOS Β· Linux

Before you start

  • No prior coding needed. Just a computer and a web browser.
  • Any term new? The Glossary has it.

Learning objectives

By the end of this lesson you will be able to: install R from CRAN; install the RStudio Desktop workspace; confirm both are working; and install your first packages.

Can't install right now? You can still start

Installing is the step that stops most beginners, so it is optional at first. R Level 1 (Basics) runs real R inside your browser: no install, nothing to break. Come back here when you are ready to work with your own files, which is what professionals do.

Two pieces, and why

You install two things. R is the actual language and engine. RStudio is the workspace you'll spend your time in - it gives you a code editor, your plots, your data, and your console all in one window. R is the car; RStudio is the comfortable dashboard. Install R first, then RStudio.

Why R for bioinformatics?

R was built by statisticians, and the gold-standard tools for RNA-seq, differential expression, and genomics - DESeq2, edgeR, limma, and the whole Bioconductor project - live in R. R is the standard home for expression analysis, so learning it opens all of those tools to you.

Step 1 - Install R (from CRAN)

R is distributed by CRAN (the Comprehensive R Archive Network) at cran.r-project.org. Pick your OS:

πŸͺŸ Windows Windows

  1. Go to cran.r-project.org β†’ "Download R for Windows" β†’ "base" β†’ "Download R for Windows".
  2. Run the .exe installer and accept the defaults.

🍎 macOS Intel & Apple Silicon

  1. Go to cran.r-project.org β†’ "Download R for macOS".
  2. Pick the right .pkg: arm64 for any Apple Silicon (M-series) Mac running macOS 14 or newer, or the x86_64 build for Intel Macs.
  3. Open the .pkg and follow the installer.

🐧 Linux Ubuntu / Debian

The quickest route on Ubuntu/Debian:

sudo apt update
sudo apt install r-base

For the very latest R, CRAN has per-distro instructions at cran.r-project.org/bin/linux. On Fedora, use sudo dnf install R.

Step 2 - Install RStudio Desktop (free)

Go to the RStudio Desktop download page and download the free RStudio Desktop for your OS. It will detect the R you just installed automatically.

Current RStudio versions need Windows 11 or macOS 14 or newer (64-bit Linux is fine). On an older computer, check the download page for an older release, or skip RStudio for now and use the in-browser R cells on this site.

  • Windows: run the .exe installer.
  • macOS: open the .dmg and drag RStudio into Applications.
  • Linux: download the .deb (Ubuntu/Debian) or .rpm (Fedora) and install it.

Step 3 - Check it worked

Open RStudio. In the Console pane (bottom-left), type this and press Enter:

R.version.string
# [1] "R version 4.x.x ..."
1 + 1
# [1] 2

If R answers, you're in business. πŸŽ‰

Step 4 - Install your first packages

Packages add features. We'll grab the tidyverse (the modern toolkit for data work) and palmerpenguins (a friendly real dataset we'll use in the project). In the Console:

install.packages("tidyverse")
install.packages("palmerpenguins")

This downloads from CRAN and can take a few minutes the first time - that's normal. If R asks to use a personal library, say yes. If it asks whether to install from sources packages that need compilation, say no (compiling needs extra tools, such as Rtools on Windows).

Decode the jargon: Bioconductor

CRAN is R's general package store. Bioconductor is a second store dedicated to biology - it's where DESeq2 and friends live. You install from it a little differently: first install.packages("BiocManager") once, then BiocManager::install("DESeq2"). You don't need it yet, but now the name won't surprise you when it shows up in Track 3.

βœ… You're ready when…

RStudio opens, 1 + 1 returns 2 in the Console, and library(tidyverse) runs without an error. It prints some red "Attaching packages" and "Conflicts ... masks" text: that is a normal message, not an error. On to the basics.

Stuck? Common snags

RStudio says it can't find R

This happens if RStudio was installed before R, or you have multiple R versions. On Windows, go to Tools β†’ Global Options β†’ General and choose the R version. On macOS or Linux (or if that does not help), reinstall R and then restart RStudio.

install.packages fails with a "non-zero exit status" on Linux

Some R packages need system libraries to compile. The error usually names what's missing (e.g. libcurl, libxml2). Install the matching -dev package with apt (e.g. sudo apt install libcurl4-openssl-dev) and try again.

Check your understanding

Where do you download R itself from?
R itself comes from CRAN. RStudio is a separate download that needs R to be installed already.
After library(tidyverse) you see red text listing "Conflicts" and functions that are "masked". What does it mean?
Red is not always an error. The message only tells you that some tidyverse functions share names with base R functions. Only text starting with "Error" means R stopped.
What does the lesson say RStudio adds on top of R?
R is the engine and RStudio is the workspace around it, giving you the editor, plots, data, and console together; the lesson calls R the car and RStudio the dashboard.
In what order does the lesson tell you to install the two pieces?
You install R first so RStudio can detect it automatically when you install RStudio afterward.
Which command installs an R package such as the tidyverse from CRAN?
Inside the RStudio Console you run install.packages("tidyverse"), which downloads and installs the package from CRAN.

Sources & further reading

  1. CRAN. R for macOS (arm64 and Intel builds, system requirements). mac.r-project.org
  2. Posit. RStudio User Guide: Download RStudio. docs.posit.co
  3. Wickham H, Cetinkaya-Rundel M, Grolemund G. R for Data Science, 2nd ed. (2023), chapter 2 "Workflow: basics". r4ds.hadley.nz
  4. Huber W, Carey VJ, Gentleman R, et al. Orchestrating high-throughput genomic analysis with Bioconductor. Nat Methods 12: 115-121, 2015. doi:10.1038/nmeth.3252

Last reviewed: October 2026.

Next in the R series (2 of 5)

First steps in RStudio: panes, scripts, help and errors β†’