# A tibble: 90 x 7
# Groups: sex, county_name, year_group, year [90]
sex county_name year_group year n population rate
<chr> <fct> <fct> <chr> <dbl> <dbl> <dbl>
1 Male Charlotte 1986-1990 1988 107 38144 137.
2 Male Charlotte 1991-1995 1993 161. 48412 161.
3 Male Charlotte 1996-2000 1998 212. 53639 187.
4 Male Charlotte 2001-2005 2003 214. 60336 174.
5 Male Charlotte 2006-2010 2008 226. 64059 176.
6 Male Charlotte 2011-2015 2013 137. 67701 99.5
# A tibble: 90 x 8
# Groups: sex, county_name, year_group, year [90]
sex county_name year_group year n population rate rate_year
<chr> <fct> <fct> <chr> <dbl> <dbl> <dbl> <dbl>
1 Male Charlotte 1986-1990 1988 535 38144 687. 137.
2 Male Charlotte 1991-1995 1993 803 48412 804. 161.
3 Male Charlotte 1996-2000 1998 1062 53639 937. 187.
4 Male Charlotte 2001-2005 2003 1072 60336 872. 174.
5 Male Charlotte 2006-2010 2008 1132 64059 881. 176.
6 Male Charlotte 2011-2015 2013 686 67701 497. 99.5
We could either return rate_year as rate or include both rate (the raw calculated rate) and rate_year.
@tgerke The question I have is what to do with n? If age_adjust() reports rates in different units than n, should we also update n as well? This is why I went with a unit-agnostic function.
I'm thinking of maybe doing a little more work to age_adjust() so that it's completely unit agnostic (e.g. changing names of arguments to be fully generalized) and then also providing an age_adjust_fcds() function that makes strong assumptions about all of the above and returns both rate and n as mean per year.
Proposal: Scale rate to yearly average and default to
5
because of default number of years in FCDS year groups.Eliminates need for final mutate step:
instead
age_adjust()
would returnWe could either return
rate_year
asrate
or include bothrate
(the raw calculated rate) andrate_year
.@tgerke The question I have is what to do with
n
? If age_adjust() reports rates in different units thann
, should we also updaten
as well? This is why I went with a unit-agnostic function.I'm thinking of maybe doing a little more work to
age_adjust()
so that it's completely unit agnostic (e.g. changing names of arguments to be fully generalized) and then also providing anage_adjust_fcds()
function that makes strong assumptions about all of the above and returns bothrate
andn
as mean per year.