Description Usage Arguments Details Value Author(s) Examples
View source: R/derive_var_atirel.R
Derives the variable ATIREL
to CONCOMITANT, PRIOR, PRIOR_CONCOMITANT or NULL
based on the relationship of cm Analysis start/end date/times to treatment start date/time
1 | derive_var_atirel(dataset, flag_var, new_var)
|
dataset |
Input dataset
The variables |
flag_var |
Name of the variable with Analysis Start Date Imputation Flag |
new_var |
Name of variable to create |
ATIREL
is set to:
null, if Datetime of First Exposure to Treatment is missing,
"CONCOMITANT", if the Analysis Start Date/Time is greater than or equal to Datetime of First Exposure to Treatment,
"PRIOR", if the Analysis End Date/Time is not missing and less than the Datetime of First Exposure to Treatment,
"CONCOMITANT" if the date part of Analysis Start Date/Time is equal to the date part of Datetime of First Exposure to Treatment and the Analysis Start Time Imputation Flag is 'H' or 'M',
otherwise it is set to "PRIOR_CONCOMITANT".
A dataset containing all observations and variables of the input
dataset and additionally the variable specified by the new_var
parameter.
Teckla Akinyi
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | library(dplyr, warn.conflicts = FALSE)
adcm <- tibble::tribble(
~STUDYID, ~USUBJID, ~TRTSDTM, ~ASTDTM, ~AENDTM, ~ASTTMF,
"TEST01", "PAT01", "2012-02-25 23:00:00", "2012-02-28 19:00:00", "2012-02-25 23:00:00", "",
"TEST01", "PAT01", "", "2012-02-28 19:00:00", "", "",
"TEST01", "PAT01", "2017-02-25 23:00:00", "2013-02-25 19:00:00", "2014-02-25 19:00:00", "",
"TEST01", "PAT01", "2017-02-25 16:00:00", "2017-02-25 14:00:00", "2017-03-25 23:00:00", "m",
"TEST01", "PAT01", "2017-02-25 16:00:00", "2017-02-25 14:00:00", "2017-04-29 14:00:00", ""
) %>% dplyr::mutate(
TRTSDTM = lubridate::as_datetime(TRTSDTM),
ASTDTM = lubridate::as_datetime(ASTDTM),
AENDTM = lubridate::as_datetime(AENDTM)
)
derive_var_atirel(
dataset = adcm,
flag_var = ASTTMF,
new_var = ATIREL
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.