Description Usage Arguments Details Value Author(s) Examples
View source: R/derive_vars_aage.R
Functions for deriving standardized age groups.
1 2 3 | derive_agegr_fda(dataset, age_var, age_unit = NULL, new_var)
derive_agegr_ema(dataset, age_var, age_unit = NULL, new_var)
|
dataset |
Input dataset. |
age_var |
AGE variable. |
age_unit |
AGE unit variable. The AGE unit variable is used to convert AGE to 'years' so that grouping can occur. This is only used when the age_var variable does not have a corresponding unit in the dataset. Default: NULL Permitted Values: 'years', 'months', 'weeks', 'days', 'hours', 'minutes', 'seconds' |
new_var |
New variable to be created. |
derive_agegr_fda()
Derive age groups according to FDA. age_var
will
be split in categories: <18, 18-64, >=65.
derive_agegr_ema()
Derive age groups according to EMA
(https://eudract.ema.europa.eu/result.html -> Results - Data Dictionary -> Age range).
age_var
will be split into categories: 0-27 days (Newborns), 28 days to
23 months (Infants and Toddlers), 2-11 (Children), 12-17 (Adolescents), 18-64,
65-84, >=85.
dataset
with new column new_var
of class factor.
Ondrej Slama
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | library(dplyr, warn.conflicts = FALSE)
library(admiral.test)
data(dm)
dm %>%
derive_agegr_fda(age_var = AGE, new_var = AGEGR1) %>%
select(SUBJID, AGE, AGEGR1)
data <- tibble::tribble(
~BRTHDT, ~RANDDT,
lubridate::ymd("1984-09-06"), lubridate::ymd("2020-02-24")
)
data %>%
derive_vars_aage(unit = "months") %>%
derive_agegr_fda(AAGE, age_unit = NULL, AGEGR1)
data.frame(AGE = 1:100) %>%
derive_agegr_fda(age_var = AGE, age_unit = "years", new_var = AGEGR1)
library(dplyr, warn.conflicts = FALSE)
library(admiral.test)
data(dm)
dm %>%
derive_agegr_ema(age_var = AGE, new_var = AGEGR1) %>%
select(SUBJID, AGE, AGEGR1)
data.frame(AGE = 1:100) %>%
derive_agegr_ema(age_var = AGE, age_unit = "years", new_var = AGEGR1)
data.frame(AGE = 1:20) %>%
derive_agegr_ema(age_var = AGE, age_unit = "years", new_var = AGEGR1)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.