[acs-r] Selecting
Nevin Krishna
nevin.krishna at gmail.com
Mon Oct 13 21:27:10 EDT 2014
Hello all,
i am fairly new to R and just started using the ACS package.
I have been playing with the examples in the link here:
http://eglenn.scripts.mit.edu/citystate/category/code/
I have adapted the code to look at another table (foreign born individuals)
by county in Louisiana: 5 year ACS ending in 2011: B05006
In the example the code ultimately calculates a proportion which is then
plotted on a map. I however want to create a dataset with the estimate of
the populations (no standard errors) of a few countries of origin (Liberia
:HD01_VD111 and Nigeria: HD01_VD112 and Sierra Leone: HD01_VD112). also i
would like to create a new variable say "combined" which is the sum of each
of these variables.
I cannot seem to figure out how to create a dataset with these variables. i
am unsure of how to manipulate the code:
us.pub.fb=divide.acs(numerator=us.fb[,111],
denominator=us.fb[,1], method="proportion")
pub.fb.est=data.frame(county=geography(us.pub.fb)[[1]],
to not calculate a proportion but to simply list the variables of interst
in a dataframe. below is the full code:
any suggestions on how to accomplish this would be appreciated.
Thanks in advance for your help!
Nevin
PS..the full code below calculates the proportion:
us.county=geo.make(state="LA", county="*")
us.fb= acs.fetch(geography=us.county, table.number="B05006")
us.pub.fb=divide.acs(numerator=us.fb[,111],
denominator=us.fb[,1], method="proportion")
pub.fb.est=data.frame(county=geography(us.pub.fb)[[1]],
percent.pub.trans=as.numeric(estimate(us.pub.fb)))
# this next step is all for Louisiana!
pub.fb.est$county=gsub("Parish", "County", pub.fb.est$county)
# clean up county names and find the states
pub.fb.est$state=gsub("^.*County, ", "", pub.fb.est$county)
pub.fb.est$county=gsub(" County,.*", "", pub.fb.est$county)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.mit.edu/pipermail/acs-r/attachments/20141013/b460fc57/attachment.htm
More information about the acs-r
mailing list