Description Usage Arguments Details Value Author(s) See Also Examples
View source: R/derive_var_last_dose_date.R
Add a variable for the dose date or datetime of the last dose to the input dataset.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
dataset |
Input dataset.
The variables specified by the |
dataset_ex |
Input EX dataset.
The variables specified by the |
filter_ex |
Filtering condition applied to EX dataset. For example, it can be used to filter for valid dose. Defaults to NULL. |
by_vars |
Variables to join by (created by |
dose_id |
Variables to identify unique dose (created by |
dose_date |
The EX dose date variable. |
analysis_date |
The analysis date variable. |
single_dose_condition |
The condition for checking if |
new_var |
The new date or datetime variable added to |
output_datetime |
Display |
traceability_vars |
A named list returned by |
The last dose date is derived as the maximum dose date where the
dose_date
is lower to or equal to the analysis_date
per by_vars
for
each observation in dataset
. When output_datetime
is TRUE
and time is
missing, then the last dose date time is imputed to 00:00:00
. However, if
date is missing, then no imputation is done.
Input dataset with additional column new_var
.
Ben Straub
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | library(dplyr, warn.conflicts = FALSE)
library(admiral.test)
data(ae)
data(ex_single)
ae %>%
head(100) %>%
derive_var_last_dose_date(
head(ex_single, 100),
filter_ex = (EXDOSE > 0 | (EXDOSE == 0 & grepl("PLACEBO", EXTRT))) &
nchar(EXENDTC) >= 10,
dose_date = EXENDTC,
analysis_date = AESTDTC,
single_dose_condition = (EXSTDTC == EXENDTC),
new_var = LDOSEDTM,
traceability_vars = dplyr::vars(LDOSEDOM = "EX", LDOSESEQ = EXSEQ, LDOSEVAR = "EXDOSE")
) %>%
select(STUDYID, USUBJID, AESEQ, AESTDTC, LDOSEDOM, LDOSESEQ, LDOSEVAR, LDOSEDTM)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.