# Get demographic information about subjects who have suffered from moderate or
# severe fatigue
library(tibble)
adsl <- tribble(
~USUBJID, ~AGE, ~SEX,
"01-701-1015", 63, "F",
"01-701-1034", 77, "F",
"01-701-1115", 84, "M",
"01-701-1146", 75, "F",
"01-701-1444", 63, "M"
)
adae <- tribble(
~USUBJID, ~AEDECOD, ~AESEV, ~AESTDTC,
"01-701-1015", "DIARRHOEA", "MODERATE", "2014-01-09",
"01-701-1034", "FATIGUE", "SEVERE", "2014-11-02",
"01-701-1034", "APPLICATION SITE PRURITUS", "MODERATE", "2014-08-27",
"01-701-1115", "FATIGUE", "MILD", "2013-01-14",
"01-701-1146", "FATIGUE", "MODERATE", "2013-06-03"
)
filter_exist(
dataset = adsl,
dataset_add = adae,
by_vars = exprs(USUBJID),
filter_add = AEDECOD == "FATIGUE" & AESEV %in% c("MODERATE", "SEVERE")
)
Run the code above in your browser using DataLab