Skip to content

Instantly share code, notes, and snippets.

######################
# GAPMINDER Exercise
######################
install.packages("gapminder")
library(gapminder)
# read in data
data(gapminder)
head(gapminder)
@dougspencer
dougspencer / 2-simulation_and_distribution.R
Last active September 9, 2025 02:17
Sept 8 in-class exercises
###########
## COIN FLIP EXERCISE
###########
# simple coin flip
rbinom(n = 1, size = 1, prob = 0.5)
# flip 100 times
rbinom(100, 1, 0.5)
@dougspencer
dougspencer / 1-summarizing and subsetting.R
Created August 27, 2025 05:55
Empirical Legal Studies (Fall 2025)
#####
# CODE SNIPPETS FROM IN-CLASS EXERCISES
# Empirical Legal Studies (Fall 2025)
#####
##########
## reading in datasets
# when reading in CSV files you need to assign to an object
# filename is the full path on your computer