Displaying 2 results from an estimated 2 matches for "statepops".
2009 Jun 23
2
Weighting column entries in a data frame
...ALASKA 2 3 10.101300 539.00
I would like to adjust "income" by population ("popul") for each state. I
can use:
statepop<-tapply(fdata$popul,fdata$state,sum),
which gives:
ALABAMA ALASKA
53590.130 7435.263
I can find the weights:
popweight <- statepops/sum(statepops)
ALABAMA ALASKA
0.016327564 0.002265338
Is there an efficient way to multiply each entry of "income" by "popweght"
conditional on the state? That is, ALABAMA income for year 1 is
9.703193*0.016327564, etc.
Thanks,
William
--
View this message...
2012 Jul 09
0
R, maps, choropleth, data keys
I have four files that map populations to appropriate keys: statepop.csv, countypop.csv, zip3.csv, and zip5.csv. I'm using the TIGER/Lines shape files: tl_2009_12_state, tl_2009_12_county tl_2009_12_zcta3, and tl_2009_12_zcta5. I have carefully followed a number of tutorials and can reproduce those, and can also produce scatter and bubble plots of my data (using long and lat coordinates to