0

I need to extract Census 2010 data for CDPs (nationwide) and figured it would be simplest to use the UScensus2010 package to extract the key tables I need, one state at a time, and then export the resulting data. Towards this end I ran the following code

 library(UScensus2010) 
 install.cdp("osx")
 demographics(dem="P0030001", state="oh",level="cdp")
 p3.race <- demographics(dem=c("P0010001", "P0030001", "P0030002",  "P0030003", "P0030004", "P0030005", "P0030006"), state="oh",level="cdp")

Note that for p3.race we have

  ..$ : chr [1:1204] "Hamler village" "Florida village" "Deshler village" "New Bavaria village" ...
  ..$ : chr [1:7] "P0010001" "P0030001" "P0030002" "P0030003" ...

So far so good. Now, what would be the best way to export p3.race (as *.csv *.dta, or any other format) such that the CDP names show up as column A and P001001:P0030006 show up as Columns B:H?

Ricardo Saporta
  • 54,400
  • 17
  • 144
  • 178
Ani
  • 313
  • 2
  • 11
  • Hi @Ani, it might be more helpful to do a `dput(p3.race)` that way we dont have to download the census data to see the full structure – Ricardo Saporta Mar 03 '13 at 23:31
  • Thanks @RicardoSaporta ... here it is (with a trimmed dataset now so it only includes P0010001). > dput(head(p.race,2)) structure(c(576, 232), .Dim = c(2L, 1L), .Dimnames = list(c("Hamler village", "Florida village"), "P0010001")) – Ani Mar 03 '13 at 23:49

0 Answers0