Skip to contents

This function retrieves and processes US Census 2020 population data to calculate population numbers by NMDP (National Marrow Donor Program) race codes and by region. It supports filtering by state or county and adjusts for individuals reporting multiple races.

Usage

us_pop_multirace_in_nmdp_codes_by_region(
  in_region,
  census_region_level = "state"
)

Arguments

in_region

A string specifying the region of interest. Valid values are:

  • "us" - Entire United States

  • "all states" - All states (not recommended for use)

  • "all counties" - All counties

  • A valid state name (e.g., "Alaska")

census_region_level

A string specifying the granularity of the data:

  • "state" - Data divided by state (default)

  • "county" - Data divided by county within a state

Value

A data frame containing population numbers by NMDP race codes and region, with the following columns:

  • region - The specified region (e.g., state or county)

  • nmdp_race_code - NMDP race code

  • total_single_race_pop - Population reporting a single race

  • total_multiple_race_pop - Population reporting multiple races

  • total_2020_pop - Total population (single + multiple race)

  • census_region - Census region corresponding to the input region

Examples

# Get population data for Alaska
us_pop_multirace_in_nmdp_codes_by_region(in_region = "Alaska")
#> # A tibble: 6 × 7
#>   region fips  nmdp_race_code total_single_race_pop total_multiple_race_pop
#>   <chr>  <chr> <chr>                          <dbl>                   <dbl>
#> 1 us     02    AFA                            20731                    5049
#> 2 us     02    API                            55904                    8554
#> 3 us     02    CAU                           421758                   31575
#> 4 us     02    HIS                            49824                       0
#> 5 us     02    NAM                           108838                   21411
#> 6 us     02    UNK                             4575                    4124
#> # ℹ 2 more variables: total_2020_pop <dbl>, census_region <chr>