Positron

Positron is the code editor (IDE) we use to write and run R and Quarto. It is built by Posit, the same company behind RStudio, and is designed for data science.
Installing Positron
- Go to https://positron.posit.co.
- Download the installer for your operating system.
- Run the installer and open Positron.
Make sure you already have R installed so Positron can find it. If your computer is too old to run Positron, don’t fret. You can log into DataHub and work with Positron there.
The layout
- Editor: where you write scripts and
.qmddocuments. - Console: a live R session for running code interactively.
- Variables / Environment: shows the objects currently in memory.
- Plots, Help, and a Terminal are available in the side panes.
Opening a folder from a GitHub repository
Most of the projects in this course start by copying (“cloning”) a repository from GitHub onto your computer and opening it as a Positron folder.
- On GitHub, open the repository and click the green Code button. Copy the HTTPS URL, which ends in
.git. - In Positron, open the Command Palette with ⇧⌘P (macOS) or Ctrl + Shift + P (Windows) and run Git: Clone.
- Paste the URL and press Return.
- Choose a folder on your computer to put the repository in — somewhere you’ll find again, like
Documents/stat133/. Positron creates a new subfolder named after the repository. - When prompted, choose Open to switch to the new folder.
The first time you clone, Git will ask for your GitHub username and a personal access token; see Git and GitHub for how to set that up.
Knowing which folder you’re in
Positron always has exactly one folder open, and everything — the console’s working directory, the file paths in your code, which repository git commands act on — is relative to that folder.
Check which one it is in the top-right corner of the window, next to the interpreter selector: it shows the name of the open folder alongside the running R session. You can also confirm from the console:
getwd()If that isn’t the folder you expect, use File → Open Folder to switch. Opening a file from another project does not change the open folder.
Running code
- Put your cursor on a line and press ⌘ + Return (macOS) or Ctrl + Enter (Windows) to run it in the console.
- Open a
.qmdfile and click Render to preview a Quarto document.