我需要为CDP(全国范围)提取2010年人口普查数据,并认为最简单的方法是使用UScensus2010程序包提取我需要的关键表,一次一个状态,然后导出结果数据。为此,我运行了以下代码
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")
请注意,p3.race
我们有
..$ : chr [1:1204] "Hamler village" "Florida village" "Deshler village" "New Bavaria village" ...
..$ : chr [1:7] "P0010001" "P0030001" "P0030002" "P0030003" ...
到目前为止一切顺利。现在,导出p3.race(如* .csv * .dta或任何其他格式)的最佳方法是将CDP名称显示为列A和P001001:P0030006显示为列B:H?