Day 2: Programming, typesetting, and tidyverse

This session will be held in JRR 399.

Base R (AM) slides here.

Quarto (PM) slides here.

Tidyverse (PM) slides here.


Functions

  • Writing and calling functions
  • Arguments, defaults, and return values

Loops, iteration, and lapply()

  • for and while loops
  • lapply() and friends
  • Guided exercise

Quarto and typesetting

  • Making work replicable and research-ready
  • Migrating the morning exercise into Quarto
  • How R Markdown fits in

Tidyverse

  • tibble
  • dplyr, from mutate() through merges
  • purrr
  • Gesturing at stringr, lubridate, and tidyr

Code for exercises:


library(tidyverse)

counties <- read_csv(
  'https://princeton-ddss.github.io/r-bootcamp/files/county_data.csv'
)

county_pop <- read_csv(
  'https://princeton-ddss.github.io/r-bootcamp/files/county_population.csv'
)