extend_source_datasets {admiral} | R Documentation |
The function ensures that the by variables are contained in all source datasets.
extend_source_datasets(source_datasets, by_vars)
source_datasets |
Source datasets A named list of datasets is expected. Each dataset must contain either all by variables or none of the by variables. |
by_vars |
By variables |
The by groups are determined as the union of the by groups occurring in the source datasets.
For all source datasets which do not contain the by variables the source dataset is replaced by the cartesian product of the source dataset and the by groups.
The list of extended source datasets
Other Advanced Functions:
assert_db_requirements()
,
assert_terms()
,
assert_valid_queries()
,
filter_date_sources()
,
format.basket_select()
,
list_tte_source_objects()
,
params()
,
validate_basket_select()
,
validate_query()
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-03T10:56", 1, "Flu",
"01", "2021-03-04", 2, "Cough",
"01", "2021", 3, "Flu"
) %>%
mutate(STUDYID = "AB42")
extend_source_datasets(
source_datasets = list(adsl = adsl, ae = ae),
by_vars = exprs(AEDECOD)
)