derive_var_trtsdtm: Derive Datetime of First Exposure to Treatment

Description Usage Arguments Details Value Author(s) Examples

View source: R/derive_var_trtsdtm.R

Description

[Questioning]

Derives datetime of first exposure to treatment (TRTSDTM)

Usage

1
2
3
4
5
6
7
derive_var_trtsdtm(
  dataset,
  dataset_ex,
  filter_ex = (EXDOSE > 0 | (EXDOSE == 0 & str_detect(EXTRT, "PLACEBO"))) &
    nchar(EXSTDTC) >= 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 EXSTDTC, 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 TRTSDTM 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_trtsdtm(dataset_ex = ex) %>%
  select(USUBJID, TRTSDTM)

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