harris-coding-lab.github.io

Materials for Stats I Coding Workshop, Harris School of Public Policy, Fall 2020

View My GitHub Profile

Coding Lab: Level 1

This website (harris-coding-lab.github.io) contains the content for the Harris School’s Accelerated Coding Lab. The workshops aim to introduce R programming concepts with a focus on preparing and analyzing data, and conducting statistical simulations. We will cover how to read data into R, manipulate data with a suite of tools from the tidyverse package dplyr. We will also discuss some basic programming concepts including data types, operators, control flow with if statements and for loops, as well as how to write your own functions.

Before Day 1:

Note: the lab material is subject to change.

Materials

Links to materials for each week’s workshop will be posted here as provided. For each class, watch the video. Then, go to lab and attempt the lab

Class Videos Slides & Code Problem sets Additional Resources
Pre-work: Why R? - video part 1: why R?
(~ 10 min)
- video part 2: a quick introduction to R, Rstudio and tidyverse
(~ 14 min)
- slides
- slide code
- lab 0
- lab code!
- solved lab
Note: Make sure to download the lab code!
Class 1: Reading data files and manipulating data with dplyr - video 1: reading data
(~ 10 min)
- video 2: manipulating data with dplyr
(~ 18 min)
- slides: reading data
- slides: manipulating data with dplyr
- slide code: reading data
- slide code: manipulating data with dplyr
- fall lab 1
- solutions
- basics review
- push lab 1
- solution push lab
- FED data from slides (you can download to follow along)
- texas data from slides
- drug cartel data from slide (you’ll need to download the dta from Dataverse)
Class 2: and Data Types - video
(~ 22 min)
- slides
- slide code
- basics review
- fall lab 2
- solution
- push lab 2
- solved push lab
- push lab Rmd template
Class 3a: If Statements - video
(~ 20 min)
- slides
- slide code
- basic review

- fall lab 3 updated 10/14 (zip file)
- fall lab 3 solutions
- push lab 3
- push lab 3a Rmd template
- solved push lab
Class 3b: Grouped analysis with dplyr - video
(~ 13 min)
- slides
- slide code
- basic review - lab 4
- push lab code
- push lab 4 Rmd template
- solved push lab
Class 4: Iteration - video
(~ 22 min)
- slides
- slide code
- basics review
- fall lab 4
- fall lab 4 zip
- solved lab
- fall lab 4 Rmd template
Class 5: Functions - video
(~ 16 min)
- slides
- slide code
- basics review
- fall lab 5
- push lab Rmd template
- push lab
- solved push lab
Bonus Class: Visualizing data with ggplot - video
(~ 18 min)
- slides
- slide code
- basic review  

Final Project

Your final project is quite simple. You will pick a data set that speaks to you and try to uncover something interesting which you will visualize in a plot. You will also compute some summary statistics that you will show in a summary table. We’ll provide feedback on your submission. Click on the link for details.

Questions

Please send questions via the Q and A google form at least 1 hour prior to Q and A sessions. We will address your questions either in lectures with Ari, in TA sessions or in written form.

Link to QA Slides Rmd Note: these are not polished and may contain typos or other ambiguities.

Additional Resources