derive_var_agegr_fda: Derive Age Groups

Description Usage Arguments Details Value Author(s) Examples

View source: R/derive_vars_aage.R

Description

Functions for deriving standardized age groups.

Usage

1
2
3
derive_var_agegr_fda(dataset, age_var, age_unit = NULL, new_var)

derive_var_agegr_ema(dataset, age_var, age_unit = NULL, new_var)

Arguments

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.

Details

derive_var_agegr_fda() derives age groups according to FDA guidance. age_var will be split in categories: <18, 18-64, >=65.

derive_var_agegr_ema() derives age groups according to EMA guidance. 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.

Value

dataset with new column new_var of class factor.

Author(s)

Ondrej Slama

Examples

 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_var_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_var_agegr_fda(AAGE, age_unit = NULL, AGEGR1)

data.frame(AGE = 1:100) %>%
  derive_var_agegr_fda(age_var = AGE, age_unit = "years", new_var = AGEGR1)

library(dplyr, warn.conflicts = FALSE)
library(admiral.test)
data(dm)

dm %>%
  derive_var_agegr_ema(age_var = AGE, new_var = AGEGR1) %>%
  select(SUBJID, AGE, AGEGR1)

data.frame(AGE = 1:100) %>%
  derive_var_agegr_ema(age_var = AGE, age_unit = "years", new_var = AGEGR1)

data.frame(AGE = 1:20) %>%
  derive_var_agegr_ema(age_var = AGE, age_unit = "years", new_var = AGEGR1)

epijim/admiral documentation built on Feb. 13, 2022, 12:15 a.m.