Adds a record for the dose intensity for each by group (e.g., subject and visit) where the source parameters are available.
Usage
derive_param_doseint(
dataset,
by_vars,
set_values_to = exprs(PARAMCD = "TNDOSINT"),
tadm_code = "TNDOSE",
tpadm_code = "TSNDOSE",
zero_doses = "Inf",
filter = NULL
)Arguments
- dataset
Input dataset
The variables specified by the
by_varsparameter,PARAMCD, andAVALare expected.The variable specified by
by_varsandPARAMCDmust be a unique key of the input dataset after restricting it by the filter condition (filterparameter) and to the parameters specified bytadm_codeandpadm_code.- by_vars
Grouping variables
Only variables specified in
by_varswill be populated in the newly created records.Permitted Values: list of variables
- set_values_to
Variables to be set
The specified variables are set to the specified values for the new observations. For example
exprs(PARAMCD = "MAP")defines the parameter code for the new parameter.Permitted Values: List of variable-value pairs
- tadm_code
Total Doses Administered parameter code
The observations where
PARAMCDequals the specified value are considered as the total dose administered. TheAVALassociated with thisPARAMCDwill be the numerator of the dose intensity calculation.Permitted Values: character value
- tpadm_code
Total Doses Planned parameter code
The observations where
PARAMCDequals the specified value are considered as the total planned dose. TheAVALassociated with thisPARAMCDwill be the denominator of the dose intensity calculation.Permitted Values: character value
- zero_doses
Flag indicating logic for handling 0 planned or administered doses for a
by_varsgroupDefault:
InfPermitted Values:
Inf,100No record is returned if either the planned (
tpadm_code) or administered (tadm_code)AVALareNA. No record is returned is a record does not exist for bothtadm_codeandtpadm_codefor the specifiedby_var.If
zero_doses=Inf:If the planned dose (
tpadm_code) is 0 and administered dose (tadm_code) is 0,NaNis returned.If the planned dose (
tpadm_code) is 0 and the administered dose (tadm_code) is > 0,Infis returned.
If
zero_doses=100:If the planned dose (
tpadm_code) is 0 and administered dose (tadm_code) is 0, 0 is returned.If the planned dose (
tpadm_code) is 0 and the administered dose (tadm_code) is > 0, 100 is returned.
- filter
Filter condition
The specified condition is applied to the input dataset before deriving the new parameter, i.e., only observations fulfilling the condition are taken into account.
Permitted Values: a condition
Value
The input dataset with the new parameter rows added. Note, a variable will only
be populated in the new parameter rows if it is specified in by_vars.
See also
BDS-Findings Functions for adding Parameters/Records:
default_qtc_paramcd(),
derive_expected_records(),
derive_extreme_event(),
derive_extreme_records(),
derive_locf_records(),
derive_param_bmi(),
derive_param_bsa(),
derive_param_computed(),
derive_param_exist_flag(),
derive_param_exposure(),
derive_param_extreme_event(),
derive_param_framingham(),
derive_param_map(),
derive_param_qtc(),
derive_param_rr(),
derive_param_wbc_abs(),
derive_summary_records()
Examples
library(tibble)
library(lubridate, warn.conflicts = FALSE)
adex <- tribble(
~USUBJID, ~PARAMCD, ~VISIT, ~ANL01FL, ~ASTDT, ~AENDT, ~AVAL,
"P001", "TNDOSE", "V1", "Y", ymd("2020-01-01"), ymd("2020-01-30"), 59,
"P001", "TSNDOSE", "V1", "Y", ymd("2020-01-01"), ymd("2020-02-01"), 96,
"P001", "TNDOSE", "V2", "Y", ymd("2020-02-01"), ymd("2020-03-15"), 88,
"P001", "TSNDOSE", "V2", "Y", ymd("2020-02-05"), ymd("2020-03-01"), 88,
"P002", "TNDOSE", "V1", "Y", ymd("2021-01-01"), ymd("2021-01-30"), 0,
"P002", "TSNDOSE", "V1", "Y", ymd("2021-01-01"), ymd("2021-02-01"), 0,
"P002", "TNDOSE", "V2", "Y", ymd("2021-02-01"), ymd("2021-03-15"), 52,
"P002", "TSNDOSE", "V2", "Y", ymd("2021-02-05"), ymd("2021-03-01"), 0
)
derive_param_doseint(
adex,
by_vars = exprs(USUBJID, VISIT),
set_values_to = exprs(PARAMCD = "TNDOSINT"),
tadm_code = "TNDOSE",
tpadm_code = "TSNDOSE"
)
#> # A tibble: 12 x 7
#> USUBJID PARAMCD VISIT ANL01FL ASTDT AENDT AVAL
#> <chr> <chr> <chr> <chr> <date> <date> <dbl>
#> 1 P001 TNDOSE V1 Y 2020-01-01 2020-01-30 59
#> 2 P001 TSNDOSE V1 Y 2020-01-01 2020-02-01 96
#> 3 P001 TNDOSE V2 Y 2020-02-01 2020-03-15 88
#> 4 P001 TSNDOSE V2 Y 2020-02-05 2020-03-01 88
#> 5 P002 TNDOSE V1 Y 2021-01-01 2021-01-30 0
#> 6 P002 TSNDOSE V1 Y 2021-01-01 2021-02-01 0
#> 7 P002 TNDOSE V2 Y 2021-02-01 2021-03-15 52
#> 8 P002 TSNDOSE V2 Y 2021-02-05 2021-03-01 0
#> 9 P001 TNDOSINT V1 NA NA NA 61.5
#> 10 P001 TNDOSINT V2 NA NA NA 100
#> 11 P002 TNDOSINT V1 NA NA NA NaN
#> 12 P002 TNDOSINT V2 NA NA NA Inf
derive_param_doseint(
adex,
by_vars = exprs(USUBJID, VISIT),
set_values_to = exprs(PARAMCD = "TDOSINT2"),
tadm_code = "TNDOSE",
tpadm_code = "TSNDOSE",
zero_doses = "100"
)
#> # A tibble: 12 x 7
#> USUBJID PARAMCD VISIT ANL01FL ASTDT AENDT AVAL
#> <chr> <chr> <chr> <chr> <date> <date> <dbl>
#> 1 P001 TNDOSE V1 Y 2020-01-01 2020-01-30 59
#> 2 P001 TSNDOSE V1 Y 2020-01-01 2020-02-01 96
#> 3 P001 TNDOSE V2 Y 2020-02-01 2020-03-15 88
#> 4 P001 TSNDOSE V2 Y 2020-02-05 2020-03-01 88
#> 5 P002 TNDOSE V1 Y 2021-01-01 2021-01-30 0
#> 6 P002 TSNDOSE V1 Y 2021-01-01 2021-02-01 0
#> 7 P002 TNDOSE V2 Y 2021-02-01 2021-03-15 52
#> 8 P002 TSNDOSE V2 Y 2021-02-05 2021-03-01 0
#> 9 P001 TDOSINT2 V1 NA NA NA 61.5
#> 10 P001 TDOSINT2 V2 NA NA NA 100
#> 11 P002 TDOSINT2 V1 NA NA NA 0
#> 12 P002 TDOSINT2 V2 NA NA NA 100
