Skip to content

Instantly share code, notes, and snippets.

@morganmelon
morganmelon / Correction Factor Script
Last active November 15, 2016 21:30
Correction factor for black men and all men 1990
#Calculating rates for Correctional vs Other Institution
#load packages
library(readr)
library(dplyr)
#read in data extract
ipums <- read_csv('data/FINALFINALDATA.csv', col_types = cols(PERWT=col_double()))
a <- ipums %>% filter((AGE>=15 & AGE<=70) & (STATEFIP!=11) & ((!(STATEFIP %in% c(2,15)) | YEAR >=1960)))
@morganmelon
morganmelon / Final Project Scripts
Last active November 10, 2016 16:08
Compilation of Final Project Scripts
#Morgan Waterman
#US History Through Census Data
#Final Project: Race, Segregation, and Incarceration in the United States, 1920-2010
#FIGURE 1: Spine Graph of Prison Population by Race 1920-2010
#load packages
library(dplyr)
library(readr)
library(ggplot2)
@morganmelon
morganmelon / Lab 7 Script
Created October 29, 2016 17:47
Income by Race and Sex 1940-2000: Box-plot, Line graph, Column Graph
#Morgan Waterm
#Lab 7
#US History Through Census Data
#Income Analysis
library(readr)
library(dplyr)
library(ggplot2)
library(RColorBrewer)
library(scales)
@morganmelon
morganmelon / Prison Spine Graph
Created October 23, 2016 00:03
Visualization 4: Spine Graph showing Percent of Prison Population By Race, 1940-2010
#Morgan Waterman
#US History Through Census Data
#Spine Graph for African American Prison Populations
library(dplyr)
library(readr)
library(ggplot2)
library(RColorBrewer)
library(scales)
@morganmelon
morganmelon / Lab 6
Last active October 22, 2016 23:04
Lab 6: Spine Graphs for Households and Children's Parents
#Morgan Waterman
#Lab 6
#Weighting by Households & Children
library(readr)
library(dplyr)
library(ggplot2)
library(RColorBrewer)
#Program to print plots
@morganmelon
morganmelon / Animation 4
Last active October 20, 2016 17:45
Percent of African American Males of Total State Male Population 1940-2010
#Morgan Waterman
#Lab 5
#Map Animation of Percent of African Americans Males of Total State Male Population (Ages 15-70) 1940-2010
#load packages
library(readr)
library(dplyr)
library(ggplot2)
library(RColorBrewer)
library(ggmap)
@morganmelon
morganmelon / Mapping Segregation
Created October 20, 2016 00:41
Black/White Segregation Indices by State 2005-9
#Morgan Waterman
#Lab 5
#Mapping Segregation By State 1940-2010
#load packages
library(readr)
library(dplyr)
library(ggplot2)
library(RColorBrewer)
library(ggmap)
@morganmelon
morganmelon / Lab 5 Animation 3
Created October 16, 2016 21:40
Map Animation of Percent of African Americans Who are Incarcerated By State 1940-2010
#Morgan Waterman
#Lab 5
#Map Animation of Percent of African Americans Who are Incarcerated By State 1940-2010
#load packages
library(readr)
library(dplyr)
library(ggplot2)
library(RColorBrewer)
library(ggmap)
@morganmelon
morganmelon / Lab 5 Animation 2
Last active October 16, 2016 22:15
Percent of Male African Americans in Total Prison Population (Ages 15-70) By State, 1940-2010
#Morgan Waterman
#Lab 5
#Map Animation of Percent of Male African Americans in Total Prison Population (Ages 15-70) By State 1940-2010
#load packages
library(readr)
library(dplyr)
library(ggplot2)
library(RColorBrewer)
library(ggmap)
@morganmelon
morganmelon / Lab 5 Animation
Last active October 16, 2016 22:13
Total Male Prison Population (Ages 15-70) by State 1940-2010
#Morgan Waterman
#Lab 5
#Map Animation of Prison Population By State 1940-2010
#load packages
library(readr)
library(dplyr)
library(ggplot2)
library(RColorBrewer)
library(ggmap)