R Code

Annotated scripts from lecture, organized by topic.

Code used in class will be posted here. Download to your own computer for use in class

Setup: Installing R & RStudio

  1. Install R from cran.r-project.org
  2. Install RStudio from posit.co

Day 1: Getting Started with R

Download these three files and put in their own folder. Assuming you have R and Rstudio installed, start by clicking on the “Project” file.

Week 1 Project

Data

Updated 1_Intro.Rmd

Day 2: Data Management and more R basics

Keeping it simple - Just one file today - download and put in your class folder

Quarto day 2

Updated Day 2 Quarto

*uses gapminder data so no need for rproject or dataset today

Day 3: Getting to know your data

Class 3 code

Pew Data

Day 4: Concepts and Cleaning

Class 4

Energy Opinion Data

Energy Codebook


Day 5: R is my friend

Class 5

Day 6: Plotting and Relationships

Class 6

Bechdel Data

Day 7: Bivariate Regression

Class 7 Regression

Day 9: Multivariate Regression

Multivariate Regression

Prem Data

Wages

Day 10: More Regression and some Experiments

More Regression

HeightandWage

GerberGreen

Day 11 Thoughts on Visualization

Some Data Visualization with Quarto

Some Data Visualization with Quarto

Day 12 Last Day R Play

Myanmar Conflict Exploration

Acled Myanmar Data Full (Save as csv and load)

Acled Myanmar Data Sample