Skip to contents

get_aging_rate is a function that allows the user to get a demographic dataset regarding the aging rate based on the given parameters.

Usage

get_aging_rate(
  v_state = "National",
  v_year = 2020,
  v_sex = c("Female", "Male", "Total"),
  v_age = c(0, 15, 24, 36)
)

Arguments

v_state

Character vector specifying the state(s) that the function will return.

v_year

Numeric vector that specifies the year(s) to return. Must have numbers between 1985 and 2020. Default is 2021.

v_sex

Character vector selecting sex. Options: Female, Male and Total.

v_age

Numeric vector that specifies the age(s) to return. Must have values between 0 and 89.

Value

A demographic dataset containing the selected year (group, when year_groups = TRUE), state, state code (CVE_GEO), sex, the aging population and the aging rate.

Examples

get_aging_rate(v_state = "National",
               v_year = seq(1991, 1995),
               v_sex = "Total",
               v_age = c(0, 89))
#> # A tibble: 10 x 7
#>     year state    CVE_GEO sex     age aging_pop aging_rate
#>    <dbl> <chr>      <dbl> <chr> <dbl>     <dbl>      <dbl>
#>  1  1991 National       0 Total     0   2674957      1.14 
#>  2  1992 National       0 Total     0   2719149      1.16 
#>  3  1993 National       0 Total     0   2763456      1.17 
#>  4  1994 National       0 Total     0   2830637      1.20 
#>  5  1995 National       0 Total     0   2679377      1.14 
#>  6  1991 National       0 Total    89     25994      0.858
#>  7  1992 National       0 Total    89     27189      0.859
#>  8  1993 National       0 Total    89     28240      0.859
#>  9  1994 National       0 Total    89     29273      0.860
#> 10  1995 National       0 Total    89     30187      0.857