使用人口普查数据获取 12 岁及以上州的人口?
get population by state 12 and older using census data?
是否可以按各州 12 岁或以上的年龄计算美国人口?我正在尝试使用 tidycensus
包,但我不确定如何限制计数以添加年龄限制。
library(tidycensus)
library(tidyverse)
census_api_key("MYKEY")
pop90 <- get_acs(geography = "state", variables = "B01003_001", year = 1990)
那个特定变量"B01003-001"
的"Universe"是总人口,它没有进一步细分,所以你无法从[=11=得到12岁以上的年龄], 只有你当时从中拉动的整个州或县或地区的人口。
但是,您可以使用 B01001
和后缀 _001
到 _049
来提取和聚合您想要的表格的数据框,以按年龄和性别,然后将它们相加。
或
你可以像上面那样拉出整个人口并减去年龄(男性和女性都不在你的目标群体中,考虑到儿童年龄组的细分与其他人相比,这工作量要少得多)
你会遇到困难的一件事是获得 12+,因为你想要排除的最高分组是 10-14...这意味着你不能 select 低于 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 数据并根据您的喜好进行汇总。
是否可以按各州 12 岁或以上的年龄计算美国人口?我正在尝试使用 tidycensus
包,但我不确定如何限制计数以添加年龄限制。
library(tidycensus)
library(tidyverse)
census_api_key("MYKEY")
pop90 <- get_acs(geography = "state", variables = "B01003_001", year = 1990)
那个特定变量"B01003-001"
的"Universe"是总人口,它没有进一步细分,所以你无法从[=11=得到12岁以上的年龄], 只有你当时从中拉动的整个州或县或地区的人口。
但是,您可以使用 B01001
和后缀 _001
到 _049
来提取和聚合您想要的表格的数据框,以按年龄和性别,然后将它们相加。
或
你可以像上面那样拉出整个人口并减去年龄(男性和女性都不在你的目标群体中,考虑到儿童年龄组的细分与其他人相比,这工作量要少得多)
你会遇到困难的一件事是获得 12+,因为你想要排除的最高分组是 10-14...这意味着你不能 select 低于 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 数据并根据您的喜好进行汇总。