State level data on population by age.
Format
A data frame with 2820 rows and 4 variables.
- state
State as 2 letter abbreviation.
- state_name
State name.
- age
Age cohort for population.
- population
Population of age cohort.
- state_total_population
total estimated state population in 2019
Examples
library(dplyr)
# List age population for each state with percent of total
pop_age_2019 |>
group_by(state_name, age) |>
mutate(percent = population / state_total_population * 100) |>
select(state_name, age, population, percent)
#> # A tibble: 4,386 × 4
#> # Groups: state_name, age [4,386]
#> state_name age population percent
#> <chr> <chr> <dbl> <dbl>
#> 1 Alabama 0 56901 1.16
#> 2 Alabama 1 58290 1.19
#> 3 Alabama 2 59073 1.20
#> 4 Alabama 3 59799 1.22
#> 5 Alabama 4 60294 1.23
#> 6 Alabama 5 59568 1.21
#> 7 Alabama 6 58599 1.20
#> 8 Alabama 7 59537 1.21
#> 9 Alabama 8 60023 1.22
#> 10 Alabama 9 60241 1.23
#> # ℹ 4,376 more rows
pop_age_2019 |>
select(state_name, state_total_population) |>
distinct() |>
arrange(desc(state_total_population))
#> # A tibble: 51 × 2
#> state_name state_total_population
#> <chr> <dbl>
#> 1 California 39512223
#> 2 Texas 28995881
#> 3 Florida 21477737
#> 4 New York 19453561
#> 5 Pennsylvania 12801989
#> 6 Illinois 12671821
#> 7 Ohio 11689100
#> 8 Georgia 10617423
#> 9 North Carolina 10488084
#> 10 Michigan 9986857
#> # ℹ 41 more rows