derive_var_atirel: Derive Time Relative to Reference

Description Usage Arguments Details Value Author(s) Examples

View source: R/derive_var_atirel.R

Description

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

Usage

1
derive_var_atirel(dataset, flag_var, new_var)

Arguments

dataset

Input dataset The variables TRTSDTM, ASTDTM, AENDTM are expected

flag_var

Name of the variable with Analysis Start Date Imputation Flag

new_var

Name of variable to create

Details

ATIREL is set to:

Value

A dataset containing all observations and variables of the input dataset and additionally the variable specified by the new_var parameter.

Author(s)

Teckla Akinyi

Examples

 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
)

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