derive_param_bor {admiralonco} | R Documentation |
Adds a Parameter for Best Overall Response (without confirmation)
Description
The derive_param_bor()
function has been
superseded in favor of derive_extreme_event()
.
Adds a parameter for best overall response, without confirmation, optionally up to first progressive disease
Usage
derive_param_bor(
dataset,
dataset_adsl,
filter_source,
source_pd = NULL,
source_datasets = NULL,
reference_date,
ref_start_window,
missing_as_ne = FALSE,
aval_fun,
set_values_to,
subject_keys = get_admiral_option("subject_keys")
)
Arguments
dataset |
The input dataframe from which the Best Overall Response will be derived from and added to. The columns After applying Permitted Values: a |
dataset_adsl |
ADSL input dataset. The columns specified in the subject_keys argument are expected. For each subject in
the passed Permitted Values: a |
filter_source |
Filter to be applied to |
source_pd |
Date of first progressive disease (PD) If the parameter is specified, the observations of the input Permitted Values: a |
source_datasets |
Source dataframe to be used to calculate the first PD date A named list of dataframes is expected (although for BOR) only one dataframe is
needed. It links the For example if pd_date <- date_source( dataset_name = "adrs", date = ADT, filter = PARAMCD == PD ) and the actual response dataframe in the script is |
reference_date |
Reference date The reference date is used along with Permitted Values: a numeric date column |
ref_start_window |
Stable disease time window The ref_start_window is used along with Permitted Values: a non-negative numeric scalar |
missing_as_ne |
Consider no assessments as If the argument is set to Permitted Values: a logical scalar |
aval_fun |
Deprecated, please use Function to map character analysis value ( The (first) argument of the function must expect a character vector and the function must return a numeric vector. |
set_values_to |
New columns to set A named list returned by |
subject_keys |
Columns to uniquely identify a subject Permitted Values: A list of symbols created using |
Details
Calculates the best overall response (BOR) parameter, as detailed below.
Records after PD can be removed using the source_pd and source_datasets arguments.
Note:
All
CR
,PR
andPD
response records are considered for Best Overall Response.All
SD
orNON-CR/NON-PD
records whereADT
>=reference_date
+ref_start_window
are also considered for Best Overall Response.Subjects with ONLY an
SD
orNON-CR/NON-PD
records whereADT
<reference_date
+ref_start_window
are assigned a Best Overall Response ofNE
.The Best Response, from the records in steps 1 to 3, is then selected in the following order of preference: CR, PR, SD, NON-CR/NON-PD, PD, NE, MISSING
The
AVAL
column is added and set using theaval_fun(AVALC)
functionThe columns specified by the
set_values_to
parameter and records are added to the dataframe passed into thedataset
argument
Note: Any responses of SD or NON-CR/NON-PD that occur before reference_date
+
ref_start_window
are ignored in the calculation of BOR. All other responses are included
in the calculation of BOR, irrespective of the number of days from the reference date.
Also Note: All columns from the input dataset are kept. For subjects with no records in
the input dataset (after the filter is applied) all columns are kept from ADSL which are
also in the input dataset. Columns which are not to be populated for the new parameter
or populated differently (e.g. RSSTRESC
, VISIT
, PARCATy
, ANLzzFL
, ...) should be
overwritten using the set_values_to
parameter.
Value
The dataframe passed in the dataset
argument with additional columns and/or
rows as set in the set_values_to
argument.
Author(s)
Stephen Gormley
See Also
Other superseded:
derive_param_clinbenefit()
,
derive_param_confirmed_bor()
,
derive_param_confirmed_resp()
,
derive_param_response()
,
filter_pd()
Examples
library(magrittr)
library(dplyr)
library(tibble)
library(lubridate)
library(admiral)
# Create ADSL dataset
adsl <- tribble(
~USUBJID, ~TRTSDTC,
"1", "2020-01-01",
"2", "2019-12-12",
"3", "2019-11-11",
"4", "2019-12-30",
"5", "2020-01-01",
"6", "2020-02-02",
"7", "2020-02-02",
"8", "2020-04-01"
) %>%
mutate(
TRTSDT = ymd(TRTSDTC),
STUDYID = "XX1234"
)
# Create ADRS dataset
ovr_obs <- tribble(
~USUBJID, ~ADTC, ~AVALC, ~ANL01FL,
"1", "2020-01-01", "PR", "Y",
"1", "2020-02-01", "CR", "Y",
"1", "2020-02-16", "NE", "Y",
"1", "2020-03-01", "CR", "Y",
"1", "2020-04-01", "SD", "Y",
"2", "2020-01-01", "SD", "Y",
"2", "2020-02-01", "PR", "Y",
"2", "2020-03-01", "SD", "Y",
"2", "2020-03-13", "CR", "Y",
"3", "2019-11-12", "CR", "Y",
"3", "2019-12-02", "CR", "Y",
"3", "2020-01-01", "SD", "Y",
"4", "2020-01-01", "PR", "Y",
"4", "2020-03-01", "SD", "N",
"4", "2020-04-01", "SD", "Y",
"4", "2020-05-01", "PR", "Y",
"4", "2020-05-15", "NON-CR/NON-PD", "Y",
"5", "2020-01-01", "PR", "Y",
"5", "2020-01-10", "SD", "Y",
"5", "2020-01-20", "PR", "Y",
"5", "2020-05-15", "NON-CR/NON-PD", "Y",
"6", "2020-02-06", "PR", "Y",
"6", "2020-02-16", "CR", "Y",
"6", "2020-03-30", "PR", "Y",
"6", "2020-04-12", "PD", "Y",
"6", "2020-05-01", "CR", "Y",
"6", "2020-06-01", "CR", "Y",
"7", "2020-02-06", "PR", "Y",
"7", "2020-02-16", "CR", "Y",
"7", "2020-04-01", "NE", "N"
) %>%
mutate(PARAMCD = "OVR")
pd_obs <-
bind_rows(tribble(
~USUBJID, ~ADTC, ~AVALC,
"2", "2020-03-01", "Y",
"4", "2020-02-01", "Y"
) %>%
mutate(PARAMCD = "PD"))
adrs <- bind_rows(ovr_obs, pd_obs) %>%
mutate(
ADT = ymd(ADTC),
STUDYID = "XX1234"
) %>%
select(-ADTC) %>%
derive_vars_merged(
dataset_add = adsl,
by_vars = exprs(STUDYID, USUBJID),
new_vars = exprs(TRTSDT)
)
pd_date <- date_source(
dataset_name = "adrs",
date = ADT,
filter = PARAMCD == "PD"
)
aval_fun_pass <- function(arg) {
case_when(
arg == "CR" ~ 11,
arg == "PR" ~ 22,
arg == "SD" ~ 33,
arg == "NON-CR/NON-PD" ~ 44,
arg == "PD" ~ 55,
arg == "NE" ~ 66,
arg == "MISSING" ~ 77,
TRUE ~ NA_real_
)
}
# Derive best overall response parameter
derive_param_bor(
adrs,
dataset_adsl = adsl,
filter_source = PARAMCD == "OVR" & ANL01FL == "Y",
source_pd = pd_date,
source_datasets = list(adrs = adrs),
aval_fun = aval_fun_pass,
reference_date = TRTSDT,
ref_start_window = 28,
set_values_to = exprs(
PARAMCD = "BOR",
PARAM = "Best Overall Response"
)
) %>%
filter(PARAMCD == "BOR")