This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setwd("/Users/brown/Documents/Berkeley/dataviz-fall-2013/Chicago-guns") | |
library(maptools) | |
library(RColorBrewer) | |
get_second_element <- function(item) { | |
return (item[2]) | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Assign a variable to your data set | |
data <- read.csv("ssamatab1.csv") | |
//Assign a variable to the California subset (or whatever subset you're looking at) | |
ca <- subset(data, data$ST.FIPS.Code == 06) | |
//aggregate data (whatever that means...), in this case California's total labor by year | |
ca_workforce_by_year <- aggregate(ca$Civilian.Labor.Force, list(ca$Year), sum) | |
names(ca_workforce_by_year)[1] <- "Year" |