DS 1: Machine setup

Week 1 · Tuesday, Sep 29 · 9:50-10:55 am · Self-guided

Dr. Marcela Alfaro Córdoba

Goal for this morning

By 10:55 you should have a machine that is ready for the whole quarter:

  1. R, Positron, and git installed and working
  2. git knows who you are
  3. AI assistance off in Positron
  4. A course folder and your first script
  5. The tidyverse packages installed

Work at your own pace, top to bottom. Done early? Help a neighbor. Explaining a fix is great practice.

No printout this week. The DS grade cycle starts next Tuesday.

Check 1: R and Positron

Open Positron. In the Console, type:

R.version.string

You should see something like [1] "R version 4.x.x (...)".

Warning

No R in the top right corner, or no Console? Click the interpreter picker (top right) and choose R. If it’s not listed, R isn’t installed: go back to cloud.r-project.org, install it, and restart Positron.

Check 2: git

In Positron, open a terminal: Terminal → New Terminal. Type:

git --version

Now tell git who you are, using the same email as your GitHub account:

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

The last line should print back your name and email.

Check 3: Turn off AI in Positron

For DS, lessons, and in-class work, no AI suggestions of any kind.

  1. Open settings: Cmd + , (Mac) or Ctrl + , (Windows/Linux)
  2. Search assistant: make sure Positron Assistant is not enabled
  3. Search inline suggest: uncheck Editor › Inline Suggest: Enabled
  4. Open the Extensions view: if GitHub Copilot or another AI extension is installed, Disable it

Note

Why? Your first weeks build the habits you’ll later use to judge AI output: reading code and working out errors yourself.

Check 4: A home for your course work

  1. Make a folder called stat266a somewhere you’ll find it (for example, Documents/stat266a)
  2. In Positron: File → Open Folder… and choose stat266a
  3. Inside it, create a folder called week01

Tip

Folder and file names: lowercase, no spaces, no accents. week01/first_script.R is good. Week 1/My Script (final).R will cause trouble later.

Check 5: Your first script

File → New File → R File. Type this, then save it as week01/first_script.R:

# My first R script
# Name: <your name>
# Date: 2026-09-29

1 + 1
Sys.Date()

Put your cursor on a line and press Cmd + Enter (Mac) or Ctrl + Enter (Windows/Linux). The result appears in the Console.

Check 6: Install the tidyverse

In the Console (not the script), type:

install.packages("tidyverse")

This downloads many packages, so it can take a few minutes. Then check:

library(tidyverse)

A message listing the attached packages (ggplot2, dplyr, …) means it worked. We’ll use these from Week 4 on.

Troubleshooting: common problems

You see… Try…
Would you like to use a personal library instead? Answer yes (both questions)
Do you want to install from sources the packages which need compilation? Answer no
Positron can’t find R Restart Positron. If that fails, reinstall R, then restart
git: command not found (Windows) Close and reopen Positron after installing Git for Windows
Mac Command Line Tools install stalls Run xcode-select --install in the Terminal
Anything else Copy the exact error message and ask a neighbor, then me

How to ask for help well

A good help request includes:

  1. What you were trying to do
  2. What you typed, exactly
  3. What happened: the full error message, copied, not paraphrased
  4. What you already tried

This works with classmates, on Ed Discussion, and in office hours. It’s also the first step of the help routine we practice in Week 2.

Done? Final checklist

All done? Walk around and help someone who isn’t. See you at 1:30 pm for our first R lecture. Bring your laptop, charged!