load(url("http://www.mosaic-web.org/go/datasets/CFPB.rda"))
load(url("http://www.mosaic-web.org/go/datasets/zipPop.rda"))
zipPop = transform(zipPop, Zip = as.numeric(gsub(" zip code", "", as.character(Zip))))
sum(Population, na.rm = TRUE)
## Error: object 'Population' not found
Pop = with(zipPop, sum(Population, na.rm = TRUE))
popByState = groupBy(zipPop, by = State, Population = sum(Population, na.rm = TRUE))
## Error: could not find function "groupBy"
CFPB = rename(CFPB, c(ZIP.code = "Zip"))
## Error: could not find function "rename"
both = join(CFPB, zipPop, by = "Zip")
## Error: could not find function "join"
countByState = groupBy(both, by = State)
## Error: could not find function "groupBy"
states = join(countByState, popByState, by = "State")
## Error: could not find function "join"
byState = transform(states, per = count/Population)
## Error: object 'states' not found
CFPB was listed first since it is being joined onto. It supplies most of the data. Joining onto zipPop would be quite different.
Some have much higher numbers. D.C. has the highest, but Maryland, North Dakota, Delaware, and New Hampshire have relatively high numbers. Many of the less-populated states like Utah and Oklahoma have relatively small numbers.