Description Usage Arguments Value Examples
Determine an age from Community Health Index (CHI) number
1 | chi_age(.data, ref_date, cutoff_2000 = 20)
|
.data |
Character. A vector of CHIs as characters/strings. |
ref_date |
Dates. Single date or vector with same length as |
cutoff_2000 |
Integer. Two-digit year before which is considered 2000s. |
A vector of ages.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | library(dplyr)
# These CHIs are not real.
chi = c("1009701234", "1811431232", "1304496368")
# Age today
chi_age(chi, Sys.time())
# Age on a single date
library(lubridate)
chi_age(chi, dmy("11/09/2018"))
# Age on a vector of dates
dates = dmy("11/09/2018",
"09/05/2015",
"10/03/2014")
chi_age(chi, dates)
# From tibble
tibble(chi = chi) %>%
mutate(
age = chi_age(chi, Sys.time())
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.