library(tibble)
library(dplyr, warn.conflicts = FALSE)
library(lubridate)
adsl <- tribble(
~USUBJID, ~TRTSDT, ~EOSDT,
"01", ymd("2020-12-06"), ymd("2021-03-06"),
"02", ymd("2021-01-16"), ymd("2021-02-03")
) %>%
mutate(STUDYID = "AB42")
ae <- tribble(
~USUBJID, ~AESTDTC, ~AESEQ, ~AEDECOD,
"01", "2021-01-03", 1, "Flu",
"01", "2021-03-04", 2, "Cough",
"01", "2021-01-01", 3, "Flu"
) %>%
mutate(
STUDYID = "AB42",
AESTDT = ymd(AESTDTC)
)
ttae <- event_source(
dataset_name = "ae",
date = AESTDT,
set_values_to = exprs(
EVNTDESC = "AE",
SRCDOM = "AE",
SRCVAR = "AESTDTC",
SRCSEQ = AESEQ
)
)
admiral:::filter_date_sources(
sources = list(ttae),
source_datasets = list(adsl = adsl, ae = ae),
by_vars = exprs(AEDECOD),
create_datetime = FALSE,
subject_keys = get_admiral_option("subject_keys"),
mode = "first",
check_type = "none"
)
Run the code above in your browser using DataLab