Displaying 1 result from an estimated 1 matches for "popweght".
Did you mean:
popweight
2009 Jun 23
2
Weighting column entries in a data frame
...lt;-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 in context: http://www.nabble.com/Weighting-column-entries-in-a-data-frame-tp24171435p24171435.html
Sent from the R help mailing list archive at Nabble.com.