使用人口普查数据获得12岁及以上州的人口?

时间:2017-08-23 19:02:02

标签: r census tidycensus

是否有可能在12岁或12岁以上的州内获得美国人口?我尝试使用tidycensus软件包,但我不确定如何限制计数以添加年龄限制。

library(tidycensus)
library(tidyverse)
census_api_key("MYKEY")
pop90 <- get_acs(geography = "state", variables = "B01003_001", year = 1990)

1 个答案:

答案 0 :(得分:1)

&#34;宇宙&#34;因为该特定变量"B01003-001"是总人口,所以不会进一步细分,因此您无法从"B01003-001"获得12岁以上的年龄,只能获得整个州或县的人口你当时正在拉扯的那条道路。

但是,您可以使用B01001和后缀_001_049来拉取和汇总所需表格的数据框,以便按年龄和性别划分人口然后加起来。

你可以像上面那样拉扯整个人口并减去年龄(男性和女性都不在你的目标群体中,考虑到儿童年龄组与其余生活相比,这项工作要少得多)< / p>

你将遇到困难的一件事是获得12+,因为你想要排除的最高分组是10-14 ......这意味着你不能选择12岁以下

所有种族的性别一般年龄代码:

    B01001_001                     Total: 
    B01001_002                      Male: 
    B01001_003        Male: Under 5 years 
    B01001_004         Male: 5 to 9 years 
    B01001_005       Male: 10 to 14 years 
    B01001_006       Male: 15 to 17 years 
    B01001_007      Male: 18 and 19 years 
    B01001_008             Male: 20 years 
    B01001_009             Male: 21 years 
    B01001_010       Male: 22 to 24 years 
    B01001_011       Male: 25 to 29 years 
    B01001_012       Male: 30 to 34 years 
    B01001_013       Male: 35 to 39 years 
    B01001_014       Male: 40 to 44 years 
    B01001_015       Male: 45 to 49 years 
    B01001_016       Male: 50 to 54 years 
    B01001_017       Male: 55 to 59 years 
    B01001_018      Male: 60 and 61 years 
    B01001_019       Male: 62 to 64 years 
    B01001_020      Male: 65 and 66 years 
    B01001_021       Male: 67 to 69 years 
    B01001_022       Male: 70 to 74 years 
    B01001_023       Male: 75 to 79 years 
    B01001_024       Male: 80 to 84 years 
    B01001_025    Male: 85 years and over 
    B01001_026                    Female: 
    B01001_027      Female: Under 5 years 
    B01001_028       Female: 5 to 9 years 
    B01001_029     Female: 10 to 14 years 
    B01001_030     Female: 15 to 17 years 
    B01001_031    Female: 18 and 19 years 
    B01001_032           Female: 20 years 
    B01001_033           Female: 21 years 
    B01001_034     Female: 22 to 24 years 
    B01001_035     Female: 25 to 29 years 
    B01001_036     Female: 30 to 34 years 
    B01001_037     Female: 35 to 39 years 
    B01001_038     Female: 40 to 44 years 
    B01001_039     Female: 45 to 49 years 
    B01001_040     Female: 50 to 54 years 
    B01001_041     Female: 55 to 59 years 
    B01001_042    Female: 60 and 61 years 
    B01001_044    Female: 65 and 66 years 
    B01001_045     Female: 67 to 69 years 
    B01001_046     Female: 70 to 74 years 
    B01001_047     Female: 75 to 79 years 
    B01001_048     Female: 80 to 84 years 
    B01001_049  Female: 85 years and over

因此,您需要以某种方式调整模型或获取PUMS数据并根据自己的喜好进行聚合。