Setup your machine for data science with R & Python

A short guide to getting a fresh machine ready for the courses

These guidelines are meant to be followed during the live setup block at the start of the term, but also works standalone if you come to class with an already-configured machine (skip ahead). We target latest stable versions of everything. If you are on Linux, see the dedicated Ubuntu section first: it slightly reshapes the steps below.

1. Install R

R is the language itself. Download the installer for your OS and follow the instructions:

Check it works:

R.version.string   # e.g. "R version 4.6.1"

2. Install Quarto

Quarto is our open-source scientific and technical publishing system. It turns .qmd documents (and RevealJS slides!) into polished HTML, PDF, and more.

Check it works:

quarto --version   # e.g. 1.10.x

3. Install Positron (the IDE)

Positron is a next-generation data science IDE (a data-science-flavoured fork of VS Code) that runs both R and Python.

Open Positron. On first launch it will offer to install the R extensions and detect your R installation. Confirm both.

Positron will use this Quarto automatically for the Quarto preview/render.

4. Linux (Ubuntu)

If you run Ubuntu, install the three applications above from their .deb binaries, then set up R packages. Two routes are available for packages: the fast, recommended r2u binaries, or a manual compile-from-source fallback. Both are detailed below.

4.1 Install R, Quarto and Positron from .deb files

Download the .deb installer for each of R, Quarto and Positron from their respective sites (choose the arm64 build on an ARM, Apple-Silicon-style machine, or x86_64 otherwise). Then install them together and let apt pull in any missing dependencies:

sudo dpkg -i ~/Downloads/*.deb     # adjust the path to where you saved the files
sudo apt --fix-broken install

The second command is the important clean-up step: dpkg -i itself does not install dependency packages, so it will often report missing dependencies, which apt --fix-broken install then resolves. If you prefer, a plain sudo apt install -f works the same.

For R alone you do not have to use the CRAN .deb at all. If you prefer your package manager, install r-base (and r-base-dev) from the Ubuntu or CRAN apt repository afterwards with sudo apt install r-base r-base-dev instead. Either way you do not need RStudio: Positron is the IDE, and it talks to whatever R binary sits on your PATH.

4.3 Fallback: compile from source

Use this route if your Ubuntu release is not covered by r2u, you do not want a system-wide (sudo) install, or a package you need is not in r2u. Compiling the tidyverse from source needs both a C/C++ toolchain and the header files of the system libraries several of its packages link against. Install them all at once:

sudo apt update && sudo apt install -y \
  r-base r-base-dev cmake \
  libcurl4-openssl-dev libssl-dev libxml2-dev libfontconfig1-dev \
  libharfbuzz-dev libfribidi-dev libfreetype6-dev libpng-dev \
  libjpeg-dev

(on 24.04 “noble” the JPEG/TIFF library is libtiff6-dev; on 22.04 “jammy” and older it is libtiff5-dev, so append the one matching your release).

Then, still in the terminal, install pak (a modern, fast package manager that also helps resolve these build issues) and use it from the R console:

sudo Rscript -e 'install.packages("pak")'
pak::pak("tidyverse")
library(tidyverse)

Unlike the r2u path (4.2) where plain install.packages() pulls prebuilt binaries, here pak actually compiles from source, but it does the dependency bookkeeping for you and caches the compiled result, so a later reinstallation is quick.

5. Install R packages

Open the R console in Positron and run:

install.packages("tidyverse")   # the core data-science collection

On Ubuntu with r2u set up (section 4.2), this command automatically installs Ubuntu binaries, so you do not need pak or the manual toolchain. On macOS/Windows the installer handles everything for you.

A note on the two commands you will meet in this guide:

  • install.packages() is the R-basics installer. With r2u (+bspm) running it installs Ubuntu binaries, which is why it is the default here.
  • pak::pak() is an optional third-party package manager with better dependency resolution and caching, and can also install straight from GitHub or a local folder. It does not go through r2u, so on the r2u path it offers no speed advantage. Reach for it when a package is not (yet) on CRAN, or to compile from source as in the fallback (section 4.3).

Verify with:

library(tidyverse)

You should see the package startup message listing dplyr, tidyr, ggplot2, readr, purrr, tibble, stringr, forcats.

By the time of the Reproducible Workflows course you will additionally want:

install.packages(c("janitor", "naniar", "skimr", "gt", "palmerpenguins", "withr", "knitr", "rmarkdown", "pins", "usethis", "gitcreds"))

(pins for data pinning; withr scopes options like random-number seeds so a render is reproducible; janitor/naniar/skimr feed the data-cleaning and EDA labs; gt formats report tables; palmerpenguins ships the penguins data used by the session-1 labs; usethis and gitcreds drive the Session 2/3 git work, including the GitHub personal-access-token setup in section 6. All of these are available as r2u binaries too, so the same plain install.packages() call above works unchanged on the r2u path. Pinning the R and package versions of a project is done with uvr (section 5.1), not installed here.)

5.1 A managed R and packages with uvr

For the Reproducible Workflows course you pin a whole project, not just one machine: the R version and every package’s version, so the project re-runs identically next year on another machine. That is what uvr does. It is a thin wrapper that lets R use uv (the same Rust project manager that drives the Python setup in sections 9–10). Install it from GitHub, then install its binary:

pak::pak("nbafrank/uvr-r")   # the uvr companion R package
uvr::install_uvr()           # installs the uvr binary (cross-platform)

Inside a project folder (uvr::init()), uvr manages a project-local R (uvr::r_install("4.6.1"), uvr::r_pin("4.6.1")) and adds packages to a manifest + lockfile with uvr::add("tidyverse"). So uvr is not only about which R version you run: it installs and pins every dependency behind a lockfile. That makes it the project-scoped alternative to the r2u / install.packages() / pak::pak() routes above. Use those to get R and packages working machine-wide; reach for uvr once you are inside a real project you need to reproduce.

6. Version control with git

The Reproducible Workflows course versions everything with git (added in Session 2). Install it first, then set your identity:

git --version                    # e.g. 2.4x.x

Your git identity should match the account you use on GitHub, where your repositories will be hosted. If you do not have one yet, create a free account at https://github.com. Then set the same name and email you used there as your global git identity:

git config --global user.name "Your Name"
git config --global user.email "you@example.com"

If you are already working in R, usethis::use_git_config() walks you through setting these same values; usethis and gitcreds are handy companions for all the Session 2/3 git work (see https://happygitwithr.com/hello-git).

One more step before pushing to GitHub in Session 2: give your machine a personal access token (PAT). From the R console, run usethis::create_github_token() (opens GitHub’s token page; copy the token), then gitcreds::gitcreds_set() (pastes it into your credentials store). git push and usethis::use_github() then authenticate automatically.

7. Publishing with Posit Connect

Session 3 reports are published to Posit Connect, the server that puts your work live at a URL. There is nothing to install, but you do need an account on the server: set one up in advance, as a free-tier account is sufficient for this course. The instructor will hand out the sign-up URL in Session 3. Then you publish from inside Quarto with quarto publish connect.

8. Some worthy Positron extensions (optional)

  • Air: A Visual Studio Code extension for Air, an R formatter and language server, written in Rust.
  • Jarl: A Visual Studio Code extension for Jarl, a fast R linter.
  • Posit Assistant: An AI assistant for Positron. It uses functionality that is available only in Positron, so it will not work with other VS Code forks, like Cursor or Windsurf.
  • Pyrefly: The Pyrefly extension uses Pyrefly to provide language server features for Python in VS Code. Please see https://pyrefly.org for more information.
  • Quarto: A Visual Studio Code extension for the Quarto scientific and technical publishing system.
  • Shiny: This is an extension to help launch Shiny applications. Shiny is a package for Python and R that is designed to make it easy to build interactive web applications with the powerful data and scientific features of Python and R.

Some of them are pre-installed with Positron; other require opt-in installs via the Extensions panel.

9. Setup Python (optional)

In Positron:

  • Open the palette with the keyboard shortcut CMD + SHIFT + P;
  • Search for Python: install Python via uv and proceed.

More at https://opensource.posit.co/blog/2026-07-08_positron-uv/

10. Install Python packages (optional)

uv is an extremely fast Python package and project manager, written in Rust.

You can easily install Python packages in dedicated virtual environments with uv. For example, to install the pandas and numpy packages, run in the Positron-integrated terminal:

uv init example
# Initialized project `example` at `/home/user/example`
uv add pandas numpy

More details can be found on the website.

11. Version checks, all together

For these courses we will use R, Quarto and git. Check all three at once.

In the R console:

R.version.string            # the R version, e.g. "R version 4.6.1"

and in a terminal:

quarto --version            # e.g. 1.10.x
git --version               # e.g. 2.4x.x

(If you also set up Python with uv in sections 9–10, uv --version confirms that too.)

If everything reports a version, you are ready. Ask the instructor for help if any step errors; resolve these at the start so the labs run smoothly.