R - 使用人口普查数据按州获取 12 岁及以上的人口?



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

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

该特定变量"B01003-001"的"宇宙"是总人口,它没有比这更进一步的细分,因此您无法从"B01003-001"获得12+年龄,只能获得您当时从中抽取的整个州或县或地区的人口。

但是,您可以使用B01001和后缀_001_049来提取所需的表的数据框,然后将它们相加。

您可以像上面一样提取整个人口并减去年龄(男性和女性都不在您的目标群体中,考虑到与其余生活相比,儿童年龄组的细分,工作量要少得多(

你会很难接受的一件事是获得 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数据并根据自己的喜好进行聚合。

相关内容

  • 没有找到相关文章

最新更新