Derive change from baseline (CHG
) in a BDS dataset
Details
Change from baseline is calculated by subtracting the baseline value from the analysis value.
See also
BDS-Findings Functions that returns variable appended to dataset:
derive_var_analysis_ratio()
,
derive_var_anrind()
,
derive_var_atoxgr_dir()
,
derive_var_atoxgr()
,
derive_var_basetype()
,
derive_var_base()
,
derive_var_ontrtfl()
,
derive_var_pchg()
,
derive_var_shift()
Examples
library(tibble)
advs <- tribble(
~USUBJID, ~PARAMCD, ~AVAL, ~ABLFL, ~BASE,
"P01", "WEIGHT", 80, "Y", 80,
"P01", "WEIGHT", 80.8, "", 80,
"P01", "WEIGHT", 81.4, "", 80,
"P02", "WEIGHT", 75.3, "Y", 75.3,
"P02", "WEIGHT", 76, "", 75.3
)
derive_var_chg(advs)
#> # A tibble: 5 x 6
#> USUBJID PARAMCD AVAL ABLFL BASE CHG
#> <chr> <chr> <dbl> <chr> <dbl> <dbl>
#> 1 P01 WEIGHT 80 "Y" 80 0
#> 2 P01 WEIGHT 80.8 "" 80 0.800
#> 3 P01 WEIGHT 81.4 "" 80 1.4
#> 4 P02 WEIGHT 75.3 "Y" 75.3 0
#> 5 P02 WEIGHT 76 "" 75.3 0.7