Getting Started

Complete these steps before the first day of class.

ImportantChecklist

Step 1: R and RStudio

You should already have R and RStudio installed from POL 212. Just make sure both are up to date:

We’ll use the tidyverse throughout the course as well as my juanr dataset package. Open R and install the packages we need:

install.packages(c("tidyverse", "remotes"))
remotes::install_github("hail2thief/juanr")

Step 2: AI coding tool

In this course we will use an AI coding agent: a tool that can see your project files, write and run code, and manage your workflow. You have two options: Claude Code or Codex. Reminder: you can also opt out of using AI.

WarningWhat to pick?

I have only used Claude Code, and will use it exclusively in this course. However, it costs $20/month. My understanding is that Codex is free through the university and should be able to do everything we need in this course.

Claude Code is Anthropic’s coding agent. It requires a Claude Pro subscription ($20/month).

  1. Get a Claude Pro account. Sign up at claude.ai.

  2. Install Node.js. Claude Code requires Node.js (version 18+). Download and install it if you don’t already have it.

  3. Install Claude Code. Open your terminal and run:

    npm install -g @anthropic-ai/claude-code
  4. Verify it works. Type claude in your terminal. You should see an interactive prompt. Type /help to see what’s available, then /exit to quit.

Note

You can also use the Claude Code desktop app instead of the terminal.

Codex is OpenAI’s coding agent. UC Davis may provide free access through the university.

  1. Download the Codex app. Go to the Codex download page and install the desktop app for your platform (Mac or Windows).

  2. Sign in. Open the app and sign in with your UC Davis ChatGPT account.

  3. Select a project folder. Point Codex to your working directory and you’re ready to go.

Step 3: GitHub

If you haven’t used GitHub before, here’s the short version: it’s a platform for hosting code, built on top of Git, a version control system that tracks changes to your files over time. Think of it as Dropbox/Box for code. Every time you make meaningful progress (finish a problem, get code working) you “commit” a snapshot. GitHub stores those snapshots online so you have a backup and a full history of your work.

I expect you to maintain a GitHub repository for all of your coursework: problem sets, notes, and your final project. This is how you’ll share your work with me at the end of the quarter.

Create a GitHub account

Go to github.com and sign up (free). Use your UC Davis email to get access to GitHub Education benefits.

Install, configure, and set up your repository

You need Git installed, your GitHub account connected, and a private repository called pol213 for your coursework. There are two ways to do this. Option A is recommended—it lets your AI tool handle the details for you.

This is the easiest path, especially if Git is new to you. Create a folder called pol213 wherever you keep your coursework—using Finder on Mac, File Explorer on Windows, or however you prefer. Then open your AI coding tool and give it a prompt like:

Set up Git and GitHub for my POL 213 coursework. Install and configure Git if needed, create a private repo called pol213, add hail2thief and aloehrke as collaborators, and initialize it with a README.

Your AI tool will check whether Git is installed, configure it with your name and email, walk you through authenticating with GitHub, and handle the rest—creating the repo, pushing it, and adding us as collaborators. If it asks you to install or authenticate the gh CLI (GitHub’s command-line tool) along the way, follow its instructions—that’s a one-time setup.

  1. Install Git. Open your terminal and check if Git is already installed:

    git --version

    If not:

    • Mac: run xcode-select --install to get the Xcode command-line tools
    • Windows: download from git-scm.com
  2. Configure Git. Tell Git who you are (use the email associated with your GitHub account):

    git config --global user.name "Your Name"
    git config --global user.email "you@ucdavis.edu"
  3. Create the repository. Go to github.com/new and create a new repository called pol213. Make it private. Check the box to initialize with a README. Then clone it to your computer:

    git clone https://github.com/YOUR-USERNAME/pol213.git
    cd pol213
  4. Add us as collaborators. In your repo on GitHub, go to Settings > Collaborators and add hail2thief (instructor) and aloehrke (TA). This gives us access to your work.

Day-to-day workflow

At the end of each work session—whenever you finish a problem, stop for the night, or just want to save your progress before closing your laptop—tell your AI tool to commit your changes:

Commit and push my changes. Briefly describe what I worked on.

It will stage your files, write a commit message, and push to GitHub. You don’t need to memorize any Git commands.

Using AI effectively

  • Be specific. “Help me with MLE” is too vague. “Write a negative log-likelihood function for a probit model with covariates X and binary outcome y” gives the tool something to work with.
  • Show your work. Paste your code into the conversation, or point the tool to the right file. Context helps.
  • Ask it to explain. If it produces code you don’t understand, ask “explain what this line does” or “why did you use BFGS instead of Nelder-Mead?”
  • Use it for visualization. These tools are good at ggplot2. Use them to make your plots publication-quality.
  • Don’t repeat yourself. If you find yourself giving the same instructions every session (e.g., “always use = for assignment” or “never use theme_gray()”), tell the tool to save your preferences for this project. Both Claude Code and Codex support project-level configuration files that persist across sessions.