[acs-r] ACS: Summing columns but keeping block group geographies

Chris Cambron ccambron at uw.edu
Mon Dec 21 15:09:55 EST 2015


Hi,
I had a quick question that I can't seem to get a handle on.  I have an ACS
object of about a 1000 block groups on table B15002 (Sex by Education).
I'm attempting to sum columns (i.e. all the columns that indicate not
finishing HS for both males and females) prior to dividing by the block
group total.  However, when I sum columns, I seem to lose my block group
geography info and all the estimates are aggregated into a single number.
Is there a way sum columns to be divided by the total but each geography?

Any suggestions would be most appreciated.


vars<-c('B15002001', #Total followed by Males vars then Female vars
        'B15002002', #Total Male

'B15002003','B15002004','B15002005','B15002006','B15002007','B15002008','B15002009','B15002010','B15002011',
#HS

'B15002012','B15002013','B15002014','B15002015','B15002016','B15002017','B15002018',
#College
        'B15002019', #Total Female

'B15002020','B15002021','B15002022','B15002023','B15002024','B15002025','B15002026','B15002027','B15002028',
#HS

'B15002029','B15002030','B15002031','B15002032','B15002033','B15002034','B15002035')
#College

vars<-paste(substr(vars, 1L, 6L), substr(vars, 7L, 9L), sep = '_')

block.data<-acs.fetch(endyear=2010,span=5,geo=emah.blocks,variable=vars)

cols.mf<-c(3:11,20:28)
HSpct.mf <- sum(block.data[,cols.mf])

Thanks so much,
Best,
Chris

*Chris Cambron, MSW, MPP*
Doctoral Student
Social Development Research Group
School of Social Work   |  University of Washington
ccambron at uw.edu  |  www.sdrg.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.mit.edu/pipermail/acs-r/attachments/20151221/26e129f5/attachment.html


More information about the acs-r mailing list