derive_var_trtedtm: Derive Datetime of Last Exposure to Treatment

Description Usage Arguments Details Value Author(s) Examples

View source: R/derive_var_trtedtm.R

Description

[Questioning]

Derives datetime of last exposure to treatment (TRTEDTM)

Usage

1
2
3
4
5
6
7
derive_var_trtedtm(
  dataset,
  dataset_ex,
  filter_ex = (EXDOSE > 0 | (EXDOSE == 0 & str_detect(EXTRT, "PLACEBO"))) &
    nchar(EXENDTC) >= 10,
  subject_keys = vars(STUDYID, USUBJID)
)

Arguments

dataset

Input dataset

The variables specified by the by_vars parameter are expected.

dataset_ex

ex dataset

The variables EXENDTC, EXSEQ, and those specified by the filter_ex parameter are expected.

filter_ex

Filter condition for the ex dataset

Only observations of the ex dataset which fulfill the specified condition are considered for the treatment start date.

Default: EXDOSE > 0 | (EXDOSE == 0 & str_detect(EXTRT, 'PLACEBO')

Permitted Values: logical expression

subject_keys

Variables to uniquely identify a subject

A list of quosures where the expressions are symbols as returned by vars() is expected.

Details

For each group (with respect to the variables specified for the by_vars parameter) the first observation (with respect to the order specified for the order parameter) is included in the output dataset.

Value

The input dataset with TRTEDTM variable added

Author(s)

Stefan Bundfuss

Examples

1
2
3
4
5
6
7
8
library(dplyr, warn.conflicts = FALSE)
library(admiral.test)
data("ex")
data("dm")

dm %>%
  derive_var_trtedtm(dataset_ex = ex) %>%
  select(USUBJID, TRTEDTM)

epijim/admiral documentation built on Feb. 13, 2022, 12:15 a.m.