| Title: | Oncology Extension Package for ADaM in 'R' Asset Library |
|---|---|
| Description: | Programming oncology specific Clinical Data Interchange Standards Consortium (CDISC) compliant Analysis Data Model (ADaM) datasets in 'R'. ADaM datasets are a mandatory part of any New Drug or Biologics License Application submitted to the United States Food and Drug Administration (FDA). Analysis derivations are implemented in accordance with the "Analysis Data Model Implementation Guide" (CDISC Analysis Data Model Team (2021), <https://www.cdisc.org/standards/foundational/adam>). The package is an extension package of the 'admiral' package. |
| Authors: | Stefan Bundfuss [aut, cre], Amit Jain [aut], Vinh Nguyen [aut], Olga Starostecka [aut], Kiran Peddamudium [aut], Tomoyuki Namai [aut], Ross Farrugia [aut], Yirong Cao [ctb], Ashwini Weber [ctb], F. Hoffmann-La Roche AG [cph, fnd], GlaxoSmithKline LLC [cph, fnd], Amgen Inc. [cph, fnd], Bristol Myers Squibb [cph, fnd] |
| Maintainer: | Stefan Bundfuss <[email protected]> |
| License: | Apache License (>= 2) |
| Version: | 1.4.1 |
| Built: | 2026-06-04 17:18:16 UTC |
| Source: | https://github.com/pharmaverse/admiralonco |
An example response analysis dataset
admiral_adrsadmiral_adrs
An object of class tbl_df (inherits from tbl, data.frame) with 3694 rows and 75 columns.
Derived from the adsl, rs and tu datasets using {admiralonco}
(https://github.com/pharmaverse/admiralonco/blob/main/inst/templates/ad_adrs.R)
Map character response values like "PR" or "SD" to numeric values.
aval_resp(arg)aval_resp(arg)
arg |
Character vector |
1 if arg equals "CR",
2 if arg equals "PR",
3 if arg equals "SD",
4 if arg equals "NON-CR/NON-PD",
5 if arg equals "PD",
6 if arg equals "NE",
7 if arg equals "MISSING",
NA_real_ otherwise
Stefan Bundfuss
aval_resp(c("CR", "PR", "SD", "NON-CR/NON-PD", "PD", "NE", "MISSING", "ND", NA_character_))aval_resp(c("CR", "PR", "SD", "NON-CR/NON-PD", "PD", "NE", "MISSING", "ND", NA_character_))
date_source object The
date_source() function has been
deprecated without replacement as all functions using the source_pd
argument are deprecated as well.
Create a date_source object as input for source_pd argument in
{admiralonco} functions.
date_source(dataset_name, filter = NULL, date, set_values_to = NULL)date_source(dataset_name, filter = NULL, date, set_values_to = NULL)
dataset_name |
The name of the dataset, i.e. a string, used to search for the date. |
filter |
An unquoted condition for filtering |
date |
A variable or an expression providing a date. A date or a datetime can be specified. An unquoted symbol or expression is expected. |
set_values_to |
Variables to be set |
An object of class date_source.
Other deprecated:
derive_param_bor(),
derive_param_clinbenefit(),
derive_param_confirmed_bor(),
derive_param_confirmed_resp(),
derive_param_response(),
filter_pd()
pd <- date_source( dataset_name = "adrs", date = ADT, filter = PARAMCD == "PD" )pd <- date_source( dataset_name = "adrs", date = ADT, filter = PARAMCD == "PD" )
These pre-defined tte_source objects can be used as input to admiral::derive_param_tte().
death_event lastalive_censor pd_event lasta_censor rand_censor trts_censordeath_event lastalive_censor pd_event lasta_censor rand_censor trts_censor
To see the definition of the various objects simply print the object in the
R console, e.g. print(death_event). For details of how to use these objects
please refer to admiral::derive_param_tte().
Printing an object will display input dataset_name, filter (if applicable), date variable,
and appropriate values for EVNTDESC, CNSDTDSC, SRCDOM, SRCVAR, and SRCSEQ.
admiral::derive_param_tte(), admiral::tte_source(), admiral::event_source(),
admiral::censor_source()
# This shows the definition of all pre-defined `tte_source` objects that ship # with {admiralonco} for (obj in admiral::list_tte_source_objects(package = "admiralonco")$object) { cat(obj, "\n") print(get(obj, envir = getNamespace("admiralonco"))) cat("\n") }# This shows the definition of all pre-defined `tte_source` objects that ship # with {admiralonco} for (obj in admiral::list_tte_source_objects(package = "admiralonco")$object) { cat(obj, "\n") print(get(obj, envir = getNamespace("admiralonco"))) cat("\n") }
The
derive_param_bor() function has been
deprecated in favor of derive_extreme_event().
Adds a parameter for best overall response, without confirmation, optionally up to first progressive disease
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") )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") )
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 and PD response records are considered for Best Overall Response.
All SD or NON-CR/NON-PD records where ADT >= reference_date +
ref_start_window are also considered for Best Overall Response.
Subjects with ONLY an SD or NON-CR/NON-PD records where ADT <
reference_date + ref_start_window are assigned a Best Overall Response of NE.
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 columns specified by the set_values_to parameter and records
are added to the dataframe passed into the dataset 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.
The dataframe passed in the dataset argument with additional columns and/or
rows as set in the set_values_to argument.
Stephen Gormley
Other deprecated:
date_source(),
derive_param_clinbenefit(),
derive_param_confirmed_bor(),
derive_param_confirmed_resp(),
derive_param_response(),
filter_pd()
library(dplyr) library(tibble) library(lubridate) library(admiral) # ensure that `date_source()` from admiralonco is used to avoid deprecation # warning unloadNamespace("admiralonco") library(admiralonco) # 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), reference_date = TRTSDT, ref_start_window = 28, set_values_to = exprs( PARAMCD = "BOR", PARAM = "Best Overall Response", AVAL = aval_fun_pass(AVALC) ) ) %>% filter(PARAMCD == "BOR")library(dplyr) library(tibble) library(lubridate) library(admiral) # ensure that `date_source()` from admiralonco is used to avoid deprecation # warning unloadNamespace("admiralonco") library(admiralonco) # 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), reference_date = TRTSDT, ref_start_window = 28, set_values_to = exprs( PARAMCD = "BOR", PARAM = "Best Overall Response", AVAL = aval_fun_pass(AVALC) ) ) %>% filter(PARAMCD == "BOR")
The
derive_param_clinbenefit() function
has been deprecated in favor of derive_extreme_event().
Adds a parameter for clinical benefit/disease control
derive_param_clinbenefit( dataset, dataset_adsl, filter_source, source_resp, source_pd = NULL, source_datasets, reference_date, ref_start_window, aval_fun, clinben_vals = c("CR", "PR", "SD", "NON-CR/NON-PD"), set_values_to, subject_keys = get_admiral_option("subject_keys") )derive_param_clinbenefit( dataset, dataset_adsl, filter_source, source_resp, source_pd = NULL, source_datasets, reference_date, ref_start_window, aval_fun, clinben_vals = c("CR", "PR", "SD", "NON-CR/NON-PD"), set_values_to, subject_keys = get_admiral_option("subject_keys") )
Clinical benefit/disease control is first identified by looking for subjects
having response status, and then derived for subjects that have at least one
evaluable non-PD response assessment prior to first PD (Progressive Disease)
(i.e., responses inclusive of CR, PR, SD, and NON-CR/NON-PD) and after a specified
amount of time from a reference date (ref_start_window).
Note: The user input values they wish to include when determining
clinical benefit using the argument clinben_vals. The default values for this are
CR, PR, SD, and NON-CR/NON-PD, as listed above. In the below example,
eligible values be limited to CR and PR.
Example: clinben_vals <- c("CR", "PR")
The input dataset (dataset) is restricted to the observations matching
filter_source and to observations before or at the date specified by source_pd.
This dataset is further restricted to include user-generated response
assessments from clinben_vals or include response assessments of CR,
PR, SD, and NON-CR/NON-PD, exclude missing response assessments, and
exclude those less than ref_start_window after reference_date. The earliest
assessment by ADT is then selected.
The dataset identified by dataset in source_resp is restricted
according to its filter argument. The variable corresponding to the date
parameter of source_resp is considered together with ADT from the
previous step.
For the observations being added to dataset, ADT is set to the earlier
of the first assessment date representing an evaluable non-PD assessment prior
to first PD, or the date representing the start of response.
For the observations being added to dataset, AVALC is set to
Y for those subjects in the dataset meeting the criteria for clinical
benefit above
N for subjects not meeting the clinical benefit criteria in dataset
or the dataset identified in source_resp
N for subjects present in dataset_adsl but not present in dataset
or the dataset identified in source_resp.
The variables specified by set_values_to are added to the new observations
with values equal to the values specified in the same.
The new observations are added to dataset. Variables held in common
between dataset and dataset_adsl are kept for the new observations, and
are populated with their values from dataset_adsl.
The input dataset with a new parameter for clinical benefit
Andrew Smith
Other deprecated:
date_source(),
derive_param_bor(),
derive_param_confirmed_bor(),
derive_param_confirmed_resp(),
derive_param_response(),
filter_pd()
library(lubridate) library(dplyr) library(admiral) # ensure that `date_source()` from admiralonco is used to avoid deprecation # warning unloadNamespace("admiralonco") library(admiralonco) adsl <- tibble::tribble( ~USUBJID, ~TRTSDT, "01", ymd("2020-01-14"), "02", ymd("2021-02-16"), "03", ymd("2021-03-09"), "04", ymd("2021-04-21") ) %>% mutate(STUDYID = "AB42") adrs <- tibble::tribble( ~USUBJID, ~PARAMCD, ~AVALC, ~ADT, "01", "RSP", "Y", ymd("2021-03-14"), "02", "RSP", "N", ymd("2021-05-07"), "03", "RSP", "N", NA, "04", "RSP", "N", NA, "01", "PD", "N", NA, "02", "PD", "Y", ymd("2021-05-07"), "03", "PD", "N", NA, "04", "PD", "N", NA, "01", "OVR", "SD", ymd("2020-03-14"), "01", "OVR", "PR", ymd("2021-04-13"), "02", "OVR", "PR", ymd("2021-04-08"), "02", "OVR", "PD", ymd("2021-05-07"), "02", "OVR", "CR", ymd("2021-06-20"), "03", "OVR", "SD", ymd("2021-03-30"), "04", "OVR", "NE", ymd("2021-05-21"), "04", "OVR", "NA", ymd("2021-06-30"), "04", "OVR", "NE", ymd("2021-07-24"), "04", "OVR", "ND", ymd("2021-09-04"), ) %>% mutate(STUDYID = "AB42", ANL01FL = "Y") %>% derive_vars_merged( dataset_add = adsl, by_vars = exprs(STUDYID, USUBJID), new_vars = exprs(TRTSDT) ) pd <- date_source( dataset_name = "adrs", date = ADT, filter = PARAMCD == "PD" & AVALC == "Y" & ANL01FL == "Y" ) resp <- date_source( dataset_name = "adrs", date = ADT, filter = PARAMCD == "RSP" & AVALC == "Y" & ANL01FL == "Y" ) derive_param_clinbenefit( dataset = adrs, dataset_adsl = adsl, filter_source = PARAMCD == "OVR" & ANL01FL == "Y", source_resp = resp, source_pd = pd, source_datasets = list(adrs = adrs), reference_date = TRTSDT, ref_start_window = 28, set_values_to = exprs( PARAMCD = "CBR" ) ) %>% filter(PARAMCD == "CBR")library(lubridate) library(dplyr) library(admiral) # ensure that `date_source()` from admiralonco is used to avoid deprecation # warning unloadNamespace("admiralonco") library(admiralonco) adsl <- tibble::tribble( ~USUBJID, ~TRTSDT, "01", ymd("2020-01-14"), "02", ymd("2021-02-16"), "03", ymd("2021-03-09"), "04", ymd("2021-04-21") ) %>% mutate(STUDYID = "AB42") adrs <- tibble::tribble( ~USUBJID, ~PARAMCD, ~AVALC, ~ADT, "01", "RSP", "Y", ymd("2021-03-14"), "02", "RSP", "N", ymd("2021-05-07"), "03", "RSP", "N", NA, "04", "RSP", "N", NA, "01", "PD", "N", NA, "02", "PD", "Y", ymd("2021-05-07"), "03", "PD", "N", NA, "04", "PD", "N", NA, "01", "OVR", "SD", ymd("2020-03-14"), "01", "OVR", "PR", ymd("2021-04-13"), "02", "OVR", "PR", ymd("2021-04-08"), "02", "OVR", "PD", ymd("2021-05-07"), "02", "OVR", "CR", ymd("2021-06-20"), "03", "OVR", "SD", ymd("2021-03-30"), "04", "OVR", "NE", ymd("2021-05-21"), "04", "OVR", "NA", ymd("2021-06-30"), "04", "OVR", "NE", ymd("2021-07-24"), "04", "OVR", "ND", ymd("2021-09-04"), ) %>% mutate(STUDYID = "AB42", ANL01FL = "Y") %>% derive_vars_merged( dataset_add = adsl, by_vars = exprs(STUDYID, USUBJID), new_vars = exprs(TRTSDT) ) pd <- date_source( dataset_name = "adrs", date = ADT, filter = PARAMCD == "PD" & AVALC == "Y" & ANL01FL == "Y" ) resp <- date_source( dataset_name = "adrs", date = ADT, filter = PARAMCD == "RSP" & AVALC == "Y" & ANL01FL == "Y" ) derive_param_clinbenefit( dataset = adrs, dataset_adsl = adsl, filter_source = PARAMCD == "OVR" & ANL01FL == "Y", source_resp = resp, source_pd = pd, source_datasets = list(adrs = adrs), reference_date = TRTSDT, ref_start_window = 28, set_values_to = exprs( PARAMCD = "CBR" ) ) %>% filter(PARAMCD == "CBR")
The
derive_param_confirmed_bor()
function has been superseded in favor of derive_extreme_event().
Adds a parameter for confirmed best overall response (BOR)
derive_param_confirmed_bor( dataset, dataset_adsl, filter_source, source_pd = NULL, source_datasets = NULL, reference_date, ref_start_window, ref_confirm, max_nr_ne = 1, accept_sd = FALSE, missing_as_ne = FALSE, aval_fun, set_values_to, subject_keys = get_admiral_option("subject_keys") )derive_param_confirmed_bor( dataset, dataset_adsl, filter_source, source_pd = NULL, source_datasets = NULL, reference_date, ref_start_window, ref_confirm, max_nr_ne = 1, accept_sd = FALSE, missing_as_ne = FALSE, aval_fun, set_values_to, subject_keys = get_admiral_option("subject_keys") )
The input dataset (dataset) is restricted to the observations matching
filter_source and to observations before or at the date specified by
source_pd.
The following potential confirmed responses are selected from the restricted input dataset:
"CR": An assessment is considered as complete response (CR) if
AVALC == "CR",
there is a confirmatory assessment with AVALC == "CR" at least
ref_confirm days after the assessment,
all assessments between the assessment and the confirmatory
assessment are "CR" or "NE", and
there are at most max_nr_ne "NE" assessments between the
assessment and the confirmatory assessment.
"PR": An assessment is considered as partial response (PR) if
AVALC == "PR",
there is a confirmatory assessment with AVALC %in% c("CR", "PR") at least ref_confirm days after the assessment,
all assessments between the assessment and the confirmatory
assessment are "CR", "PR", "SD", or "NE",
there is no "PR" assessment after a "CR" assessment in the
confirmation period,
there are at most max_nr_ne "NE" assessments between the
assessment and the confirmatory assessment, and
if the accept_sd argument is set to TRUE, one "SD"
assessment in the confirmation period is accepted. Otherwise, no
"SD" assessment must occur within the confirmation period.
"SD": An assessment is considered as stable disease (SD) if
AVALC %in% c("CR", "PR", "SD") and
the assessment is at least ref_start_window days after
reference_date.
"NON-CR/NON-PD": An assessment is considered as NON-CR/NON-PD if
AVALC = "NON-CR/NON-PD" and
the assessment is at least ref_start_window days after
reference_date.
"PD": An assessment is considered as progressive disease (PD) if
AVALC == "PD".
"NE": An assessment is considered as not estimable (NE) if
AVALC == "NE" or
AVALC %in% c("CR", "PR", "SD", "NON-CR/NON-PD") and the
assessment is less than ref_start_window days after
reference_date.
"ND": An assessment is considered as not done (ND) if AVALC == "ND".
"MISSING": An assessment is considered as missing (MISSING) if a
subject has no observation in the input dataset.
If the missing_as_ne argument is set to TRUE, AVALC is set to
"NE" for these subjects.
For each subject the best response as derived in the previous step is
selected, where "CR" is best and "MISSING" is worst in the order above.
If the best response is not unique, the first one (with respect to ADT)
is selected. If the selected record is from the input dataset, all
variables are kept. If the selected record is from dataset_adsl, all
variables which are in both dataset and dataset_adsl are kept.
The variables specified by the set_values_to parameter are added to
the new observations.
The new observations are added to input dataset.
The input dataset with a new parameter for confirmed best overall response
Stefan Bundfuss
Other deprecated:
date_source(),
derive_param_bor(),
derive_param_clinbenefit(),
derive_param_confirmed_resp(),
derive_param_response(),
filter_pd()
library(dplyr) library(lubridate) library(admiral) # ensure that `date_source()` from admiralonco is used to avoid deprecation # warning unloadNamespace("admiralonco") library(admiralonco) # Create ADSL dataset adsl <- tibble::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", "9", "2020-03-01" ) %>% mutate( TRTSDT = ymd(TRTSDTC), STUDYID = "XX1234" ) # Create ADRS dataset ovr_obs <- tibble::tribble( ~USUBJID, ~ADTC, ~AVALC, "1", "2020-01-01", "PR", "1", "2020-02-01", "CR", "1", "2020-02-16", "NE", "1", "2020-03-01", "CR", "1", "2020-04-01", "SD", "2", "2020-01-01", "SD", "2", "2020-02-01", "PR", "2", "2020-03-01", "SD", "2", "2020-03-13", "CR", "3", "2019-11-12", "CR", "3", "2019-12-02", "CR", "3", "2020-01-01", "SD", "4", "2020-01-01", "PR", "4", "2020-03-01", "SD", "4", "2020-04-01", "SD", "4", "2020-05-01", "PR", "4", "2020-05-15", "NON-CR/NON-PD", "5", "2020-01-01", "PR", "5", "2020-01-10", "SD", "5", "2020-01-20", "PR", "5", "2020-05-15", "NON-CR/NON-PD", "6", "2020-02-06", "PR", "6", "2020-02-16", "CR", "6", "2020-03-30", "PR", "6", "2020-04-12", "PD", "6", "2020-05-01", "CR", "6", "2020-06-01", "CR", "7", "2020-02-06", "PR", "7", "2020-02-16", "CR", "7", "2020-04-01", "NE", "9", "2020-03-16", "CR", "9", "2020-04-01", "NE", "9", "2020-04-16", "NE", "9", "2020-05-01", "CR" ) %>% mutate(PARAMCD = "OVR", ANL01FL = "Y") pd_obs <- bind_rows(tibble::tribble( ~USUBJID, ~ADTC, ~AVALC, "6", "2020-04-12", "Y" ) %>% mutate(PARAMCD = "PD", ANL01FL = "Y")) 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" & ANL01FL == "Y" ) # Derive confirmed best overall response parameter derive_param_confirmed_bor( adrs, dataset_adsl = adsl, filter_source = PARAMCD == "OVR" & ANL01FL == "Y", source_pd = pd_date, source_datasets = list(adrs = adrs), reference_date = TRTSDT, ref_start_window = 28, ref_confirm = 28, set_values_to = exprs( PARAMCD = "CBOR", PARAM = "Best Confirmed Overall Response by Investigator" ) ) %>% filter(PARAMCD == "CBOR") # Derive confirmed best overall response parameter (accepting SD for PR, # accept two NEs, and considering missings as NE) derive_param_confirmed_bor( adrs, dataset_adsl = adsl, filter_source = PARAMCD == "OVR" & ANL01FL == "Y", source_pd = pd_date, source_datasets = list(adrs = adrs), reference_date = TRTSDT, ref_start_window = 28, ref_confirm = 28, max_nr_ne = 2, accept_sd = TRUE, missing_as_ne = TRUE, set_values_to = exprs( PARAMCD = "CBOR", PARAM = "Best Confirmed Overall Response by Investigator" ) ) %>% filter(PARAMCD == "CBOR")library(dplyr) library(lubridate) library(admiral) # ensure that `date_source()` from admiralonco is used to avoid deprecation # warning unloadNamespace("admiralonco") library(admiralonco) # Create ADSL dataset adsl <- tibble::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", "9", "2020-03-01" ) %>% mutate( TRTSDT = ymd(TRTSDTC), STUDYID = "XX1234" ) # Create ADRS dataset ovr_obs <- tibble::tribble( ~USUBJID, ~ADTC, ~AVALC, "1", "2020-01-01", "PR", "1", "2020-02-01", "CR", "1", "2020-02-16", "NE", "1", "2020-03-01", "CR", "1", "2020-04-01", "SD", "2", "2020-01-01", "SD", "2", "2020-02-01", "PR", "2", "2020-03-01", "SD", "2", "2020-03-13", "CR", "3", "2019-11-12", "CR", "3", "2019-12-02", "CR", "3", "2020-01-01", "SD", "4", "2020-01-01", "PR", "4", "2020-03-01", "SD", "4", "2020-04-01", "SD", "4", "2020-05-01", "PR", "4", "2020-05-15", "NON-CR/NON-PD", "5", "2020-01-01", "PR", "5", "2020-01-10", "SD", "5", "2020-01-20", "PR", "5", "2020-05-15", "NON-CR/NON-PD", "6", "2020-02-06", "PR", "6", "2020-02-16", "CR", "6", "2020-03-30", "PR", "6", "2020-04-12", "PD", "6", "2020-05-01", "CR", "6", "2020-06-01", "CR", "7", "2020-02-06", "PR", "7", "2020-02-16", "CR", "7", "2020-04-01", "NE", "9", "2020-03-16", "CR", "9", "2020-04-01", "NE", "9", "2020-04-16", "NE", "9", "2020-05-01", "CR" ) %>% mutate(PARAMCD = "OVR", ANL01FL = "Y") pd_obs <- bind_rows(tibble::tribble( ~USUBJID, ~ADTC, ~AVALC, "6", "2020-04-12", "Y" ) %>% mutate(PARAMCD = "PD", ANL01FL = "Y")) 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" & ANL01FL == "Y" ) # Derive confirmed best overall response parameter derive_param_confirmed_bor( adrs, dataset_adsl = adsl, filter_source = PARAMCD == "OVR" & ANL01FL == "Y", source_pd = pd_date, source_datasets = list(adrs = adrs), reference_date = TRTSDT, ref_start_window = 28, ref_confirm = 28, set_values_to = exprs( PARAMCD = "CBOR", PARAM = "Best Confirmed Overall Response by Investigator" ) ) %>% filter(PARAMCD == "CBOR") # Derive confirmed best overall response parameter (accepting SD for PR, # accept two NEs, and considering missings as NE) derive_param_confirmed_bor( adrs, dataset_adsl = adsl, filter_source = PARAMCD == "OVR" & ANL01FL == "Y", source_pd = pd_date, source_datasets = list(adrs = adrs), reference_date = TRTSDT, ref_start_window = 28, ref_confirm = 28, max_nr_ne = 2, accept_sd = TRUE, missing_as_ne = TRUE, set_values_to = exprs( PARAMCD = "CBOR", PARAM = "Best Confirmed Overall Response by Investigator" ) ) %>% filter(PARAMCD == "CBOR")
The
derive_param_confirmed_resp()
function has been superseded in favor of derive_extreme_event().
Adds a parameter for confirmed response
derive_param_confirmed_resp( dataset, dataset_adsl, filter_source, source_pd = NULL, source_datasets = NULL, ref_confirm, max_nr_ne = 1, accept_sd = FALSE, aval_fun, set_values_to, subject_keys = get_admiral_option("subject_keys") )derive_param_confirmed_resp( dataset, dataset_adsl, filter_source, source_pd = NULL, source_datasets = NULL, ref_confirm, max_nr_ne = 1, accept_sd = FALSE, aval_fun, set_values_to, subject_keys = get_admiral_option("subject_keys") )
The input dataset (dataset) is restricted to the observations matching
filter_source and to observations before or at the date specified by
source_pd.
A subject is considered as responder if there is at least one observation in the restricted dataset with
AVALC == "CR",
there is a confirmatory assessment with AVALC == "CR" at least
ref_confirm days after the assessment,
all assessments between the assessment and the confirmatory
assessment are "CR" or "NE", and
there are at most max_nr_ne "NE" assessments between the
assessment and the confirmatory assessment.
or at least one observation with
AVALC == "PR",
there is a confirmatory assessment with AVALC %in% c("CR", "PR") at
least ref_confirm days after the assessment,
all assessments between the assessment and the confirmatory
assessment are "CR", "PR", "SD", or "NE",
there is no "PR" assessment after a "CR" assessment in the
confirmation period,
there are at most max_nr_ne "NE" assessments between the
assessment and the confirmatory assessment,
if the accept_sd argument is set to TRUE, one "SD" assessment
in the confirmation period is accepted. Otherwise, no "SD" assessment
must occur within the confirmation period.
For responders AVALC is set to "Y" and ADT to the first date where
the response criteria are fulfilled. For all other subjects in
dataset_adsl AVALC is set to "N" and ADT to NA.
The variables specified by the set_values_to parameter are added to
the new observations.
The new observations are added to input dataset.
The input dataset with a new parameter for confirmed response
Stefan Bundfuss
Other deprecated:
date_source(),
derive_param_bor(),
derive_param_clinbenefit(),
derive_param_confirmed_bor(),
derive_param_response(),
filter_pd()
library(dplyr) library(admiral) # ensure that `date_source()` from admiralonco is used to avoid deprecation # warning unloadNamespace("admiralonco") library(admiralonco) # Create ADSL dataset adsl <- tibble::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", "9", "2020-03-01" ) %>% mutate( STUDYID = "XX1234" ) # Create ADRS dataset ovr_obs <- tibble::tribble( ~USUBJID, ~ADTC, ~AVALC, "1", "2020-01-01", "PR", "1", "2020-02-01", "CR", "1", "2020-02-16", "NE", "1", "2020-03-01", "CR", "1", "2020-04-01", "SD", "2", "2020-01-01", "SD", "2", "2020-02-01", "PR", "2", "2020-03-01", "SD", "2", "2020-03-13", "CR", "3", "2019-11-12", "CR", "3", "2019-12-02", "CR", "3", "2020-01-01", "SD", "4", "2020-01-01", "PR", "4", "2020-03-01", "SD", "4", "2020-04-01", "SD", "4", "2020-05-01", "PR", "4", "2020-05-15", "NON-CR/NON-PD", "5", "2020-01-01", "PR", "5", "2020-01-10", "SD", "5", "2020-01-20", "PR", "5", "2020-05-15", "NON-CR/NON-PD", "6", "2020-02-06", "PR", "6", "2020-02-16", "CR", "6", "2020-03-30", "PR", "6", "2020-04-12", "PD", "6", "2020-05-01", "CR", "6", "2020-06-01", "CR", "7", "2020-02-06", "PR", "7", "2020-02-16", "CR", "7", "2020-04-01", "NE", "9", "2020-03-16", "CR", "9", "2020-04-01", "NE", "9", "2020-04-16", "NE", "9", "2020-05-01", "CR" ) %>% mutate(PARAMCD = "OVR", ANL01FL = "Y") pd_obs <- bind_rows(tibble::tribble( ~USUBJID, ~ADTC, ~AVALC, "6", "2020-04-12", "Y" ) %>% mutate(PARAMCD = "PD", ANL01FL = "Y")) adrs <- bind_rows(ovr_obs, pd_obs) %>% mutate( ADT = lubridate::ymd(ADTC), STUDYID = "XX1234" ) %>% select(-ADTC) pd_date <- date_source( dataset_name = "adrs", date = ADT, filter = PARAMCD == "PD" & ANL01FL == "Y" ) # Derive confirmed response parameter derive_param_confirmed_resp( adrs, dataset_adsl = adsl, filter_source = PARAMCD == "OVR" & ANL01FL == "Y", source_pd = pd_date, source_datasets = list(adrs = adrs), ref_confirm = 28, set_values_to = exprs( PARAMCD = "CRSP", PARAM = "Confirmed Response by Investigator" ) ) %>% filter(PARAMCD == "CRSP") # Derive confirmed response parameter (accepting SD for PR and two NEs) derive_param_confirmed_resp( adrs, dataset_adsl = adsl, filter_source = PARAMCD == "OVR" & ANL01FL == "Y", source_pd = pd_date, source_datasets = list(adrs = adrs), ref_confirm = 28, max_nr_ne = 2, accept_sd = TRUE, set_values_to = exprs( PARAMCD = "CRSP", PARAM = "Confirmed Response by Investigator" ) ) %>% filter(PARAMCD == "CRSP")library(dplyr) library(admiral) # ensure that `date_source()` from admiralonco is used to avoid deprecation # warning unloadNamespace("admiralonco") library(admiralonco) # Create ADSL dataset adsl <- tibble::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", "9", "2020-03-01" ) %>% mutate( STUDYID = "XX1234" ) # Create ADRS dataset ovr_obs <- tibble::tribble( ~USUBJID, ~ADTC, ~AVALC, "1", "2020-01-01", "PR", "1", "2020-02-01", "CR", "1", "2020-02-16", "NE", "1", "2020-03-01", "CR", "1", "2020-04-01", "SD", "2", "2020-01-01", "SD", "2", "2020-02-01", "PR", "2", "2020-03-01", "SD", "2", "2020-03-13", "CR", "3", "2019-11-12", "CR", "3", "2019-12-02", "CR", "3", "2020-01-01", "SD", "4", "2020-01-01", "PR", "4", "2020-03-01", "SD", "4", "2020-04-01", "SD", "4", "2020-05-01", "PR", "4", "2020-05-15", "NON-CR/NON-PD", "5", "2020-01-01", "PR", "5", "2020-01-10", "SD", "5", "2020-01-20", "PR", "5", "2020-05-15", "NON-CR/NON-PD", "6", "2020-02-06", "PR", "6", "2020-02-16", "CR", "6", "2020-03-30", "PR", "6", "2020-04-12", "PD", "6", "2020-05-01", "CR", "6", "2020-06-01", "CR", "7", "2020-02-06", "PR", "7", "2020-02-16", "CR", "7", "2020-04-01", "NE", "9", "2020-03-16", "CR", "9", "2020-04-01", "NE", "9", "2020-04-16", "NE", "9", "2020-05-01", "CR" ) %>% mutate(PARAMCD = "OVR", ANL01FL = "Y") pd_obs <- bind_rows(tibble::tribble( ~USUBJID, ~ADTC, ~AVALC, "6", "2020-04-12", "Y" ) %>% mutate(PARAMCD = "PD", ANL01FL = "Y")) adrs <- bind_rows(ovr_obs, pd_obs) %>% mutate( ADT = lubridate::ymd(ADTC), STUDYID = "XX1234" ) %>% select(-ADTC) pd_date <- date_source( dataset_name = "adrs", date = ADT, filter = PARAMCD == "PD" & ANL01FL == "Y" ) # Derive confirmed response parameter derive_param_confirmed_resp( adrs, dataset_adsl = adsl, filter_source = PARAMCD == "OVR" & ANL01FL == "Y", source_pd = pd_date, source_datasets = list(adrs = adrs), ref_confirm = 28, set_values_to = exprs( PARAMCD = "CRSP", PARAM = "Confirmed Response by Investigator" ) ) %>% filter(PARAMCD == "CRSP") # Derive confirmed response parameter (accepting SD for PR and two NEs) derive_param_confirmed_resp( adrs, dataset_adsl = adsl, filter_source = PARAMCD == "OVR" & ANL01FL == "Y", source_pd = pd_date, source_datasets = list(adrs = adrs), ref_confirm = 28, max_nr_ne = 2, accept_sd = TRUE, set_values_to = exprs( PARAMCD = "CRSP", PARAM = "Confirmed Response by Investigator" ) ) %>% filter(PARAMCD == "CRSP")
The
derive_param_response() function has
been superseded in favor of derive_extreme_event().
Adds a parameter indicating if a response has been observed. If a response
has been observed, AVALC is set to "Y" and ADT is set to the first date
when a response has been observed. If a response has not been observed,
AVALC is set to "N" and ADT is set NA.
derive_param_response( dataset, dataset_adsl, filter_source, source_pd = NULL, source_datasets = NULL, set_values_to, aval_fun, subject_keys = get_admiral_option("subject_keys") )derive_param_response( dataset, dataset_adsl, filter_source, source_pd = NULL, source_datasets = NULL, set_values_to, aval_fun, subject_keys = get_admiral_option("subject_keys") )
The Date of the end of the assessment period (e.g. Progressive disease,
as defined by pd_source) is added to the response dataset.
The response dataset is restricted to observations occurring before or on the date of progressive disease.
For each subject (with respect to the variables specified for the
subject_keys parameter), the first observation (with respect to
ADT) where the response condition (filter_source parameter) is
fulfilled is selected.
For each observation in dataset_adsl a new observation is created.
For subjects with a response AVALC is set to "Y" and ADT to
the first date (ADT) where the response condition is fulfilled.
For all other subjects AVALC is set to "N" and ADT to NA.
The variables specified by the set_values_to parameter are added to
the new observations.
The new observations are added to input dataset.
The input dataset with a new parameter indicating if and when a response occurred
Samia Kabi
Other deprecated:
date_source(),
derive_param_bor(),
derive_param_clinbenefit(),
derive_param_confirmed_bor(),
derive_param_confirmed_resp(),
filter_pd()
library(dplyr) library(admiral) # ensure that `date_source()` from admiralonco is used to avoid deprecation # warning unloadNamespace("admiralonco") library(admiralonco) library(lubridate) library(tibble) adsl <- tribble( ~USUBJID, "1", "2", "3", "4" ) %>% mutate(STUDYID = "XX1234") adrs <- tribble( ~USUBJID, ~PARAMCD, ~ADTC, ~AVALC, ~ANL01FL, "1", "OVR", "2020-01-02", "PR", "Y", "1", "OVR", "2020-02-01", "CR", "Y", "1", "OVR", "2020-03-01", "CR", "Y", "1", "OVR", "2020-04-01", "SD", "Y", "1", "PD", NA_character_, "N", "Y", "2", "OVR", "2021-06-15", "SD", "Y", "2", "OVR", "2021-07-16", "PD", "Y", "2", "OVR", "2021-09-14", "PD", "Y", "2", "PD", "2021-09-14", "Y", "Y", "3", "OVR", "2021-09-14", "SD", "Y", "3", "OVR", "2021-10-30", "PD", "Y", "3", "OVR", "2021-12-25", "CR", "Y", "3", "PD", "2021-10-30", "Y", "Y" ) %>% mutate( STUDYID = "XX1234", ADT = ymd(ADTC), ANL01FL = "Y" ) %>% select(-ADTC) # Define the end of the assessment period for responses: # all responses before or on the first PD will be used. pd <- date_source( dataset_name = "adrs", date = ADT, filter = PARAMCD == "PD" & AVALC == "Y" ) # Derive the response parameter derive_param_response( dataset = adrs, dataset_adsl = adsl, filter_source = PARAMCD == "OVR" & AVALC %in% c("CR", "PR") & ANL01FL == "Y", source_pd = pd, source_datasets = list(adrs = adrs), set_values_to = exprs( AVAL = yn_to_numeric(AVALC), PARAMCD = "RSP", PARAM = "Response by investigator" ), subject_keys = get_admiral_option("subject_keys") ) %>% arrange(USUBJID, PARAMCD, ADT)library(dplyr) library(admiral) # ensure that `date_source()` from admiralonco is used to avoid deprecation # warning unloadNamespace("admiralonco") library(admiralonco) library(lubridate) library(tibble) adsl <- tribble( ~USUBJID, "1", "2", "3", "4" ) %>% mutate(STUDYID = "XX1234") adrs <- tribble( ~USUBJID, ~PARAMCD, ~ADTC, ~AVALC, ~ANL01FL, "1", "OVR", "2020-01-02", "PR", "Y", "1", "OVR", "2020-02-01", "CR", "Y", "1", "OVR", "2020-03-01", "CR", "Y", "1", "OVR", "2020-04-01", "SD", "Y", "1", "PD", NA_character_, "N", "Y", "2", "OVR", "2021-06-15", "SD", "Y", "2", "OVR", "2021-07-16", "PD", "Y", "2", "OVR", "2021-09-14", "PD", "Y", "2", "PD", "2021-09-14", "Y", "Y", "3", "OVR", "2021-09-14", "SD", "Y", "3", "OVR", "2021-10-30", "PD", "Y", "3", "OVR", "2021-12-25", "CR", "Y", "3", "PD", "2021-10-30", "Y", "Y" ) %>% mutate( STUDYID = "XX1234", ADT = ymd(ADTC), ANL01FL = "Y" ) %>% select(-ADTC) # Define the end of the assessment period for responses: # all responses before or on the first PD will be used. pd <- date_source( dataset_name = "adrs", date = ADT, filter = PARAMCD == "PD" & AVALC == "Y" ) # Derive the response parameter derive_param_response( dataset = adrs, dataset_adsl = adsl, filter_source = PARAMCD == "OVR" & AVALC %in% c("CR", "PR") & ANL01FL == "Y", source_pd = pd, source_datasets = list(adrs = adrs), set_values_to = exprs( AVAL = yn_to_numeric(AVALC), PARAMCD = "RSP", PARAM = "Response by investigator" ), subject_keys = get_admiral_option("subject_keys") ) %>% arrange(USUBJID, PARAMCD, ADT)
The
filter_pd() function has been
deprecated in favor of filter_relative().
Filter a dataset to only include the source parameter records up to and including the first PD (progressive disease). These records are passed to downstream derivations regarding responses such as BOR (best overall response).
filter_pd( dataset, filter, source_pd, source_datasets, subject_keys = get_admiral_option("subject_keys") )filter_pd( dataset, filter, source_pd, source_datasets, subject_keys = get_admiral_option("subject_keys") )
dataset |
Input dataset The variables |
filter |
Filter condition for restricting the input dataset |
source_pd |
A For each subject the first date ( |
source_datasets |
A named list of data sets is expected. The name must match the name provided by the |
subject_keys |
Variables to uniquely identify a subject A list of symbols created using |
The input dataset (dataset) is restricted by filter.
For each subject the first PD date is derived as the first date
(source_pd$date) in the source pd dataset
(source_datasets[[source_pd$dataset_name]]) restricted by
source_pd$filter.
The restricted input dataset is restricted to records up to first PD date. Records matching first PD date are included. For subject without any first PD date, all records are included.
A subset of the input dataset
Teckla Akinyi, Stefan Bundfuss
Other deprecated:
date_source(),
derive_param_bor(),
derive_param_clinbenefit(),
derive_param_confirmed_bor(),
derive_param_confirmed_resp(),
derive_param_response()
library(dplyr) library(lubridate) library(admiral) # ensure that `date_source()` from admiralonco is used to avoid deprecation # warning unloadNamespace("admiralonco") library(admiralonco) # Filter OVR records up to first PD, first PD date provided in separate BDS dataset (adevent) adrs <- tibble::tribble( ~STUDYID, ~USUBJID, ~PARAMCD, ~AVALC, ~ADT, ~ANL01FL, "CDISCPILOT01", "01-701-1015", "OVR", "CR", "2016-01-25", "Y", "CDISCPILOT01", "01-701-1015", "OVR", "SD", "2016-02-22", NA_character_, "CDISCPILOT01", "01-701-1015", "OVR", "PD", "2016-02-22", "Y", "CDISCPILOT01", "01-701-1015", "BOR", "CR", "2016-01-25", "Y", "CDISCPILOT01", "01-701-1034", "OVR", "SD", "2015-12-07", "Y", "CDISCPILOT01", "01-701-1034", "OVR", "PD", "2016-04-25", "Y", "CDISCPILOT01", "01-701-1034", "OVR", "PD", "2016-06-25", "Y", "CDISCPILOT01", "01-701-1034", "BOR", "SD", "2015-12-07", "Y", "CDISCPILOT01", "01-701-1035", "OVR", "SD", "2016-04-25", "Y", "CDISCPILOT01", "01-701-1035", "OVR", "PR", "2016-06-25", "Y", "CDISCPILOT01", "01-701-1035", "BOR", "PR", "2016-06-25", "Y" ) %>% mutate( ADT = as_date(ADT) ) adevent <- tibble::tribble( ~STUDYID, ~USUBJID, ~PARAMCD, ~AVALC, ~ADT, "CDISCPILOT01", "01-701-1015", "PD", "Y", "2016-02-22", "CDISCPILOT01", "01-701-1034", "PD", "Y", "2016-04-25" ) %>% mutate( ADT = as_date(ADT) ) pd <- date_source( dataset_name = "adevent", date = ADT, filter = PARAMCD == "PD" ) filter_pd( dataset = adrs, filter = PARAMCD == "OVR" & ANL01FL == "Y", source_pd = pd, source_datasets = list(adevent = adevent) ) # Filter OVR records up to first PD, first PD date provided in ADSL dataset adsl <- tibble::tribble( ~STUDYID, ~USUBJID, ~PDDT, "CDISCPILOT01", "01-701-1015", "2016-02-22", "CDISCPILOT01", "01-701-1034", "2016-04-25", "CDISCPILOT01", "01-701-1035", "" ) %>% mutate( PDDT = as_date(PDDT) ) pd <- date_source( dataset_name = "adsl", date = PDDT ) filter_pd( dataset = adrs, filter = PARAMCD == "OVR" & ANL01FL == "Y", source_pd = pd, source_datasets = list(adsl = adsl) ) # Filter OVR records up to first PD, first PD date provided in input dataset (PD parameter) adrs <- tibble::tribble( ~STUDYID, ~USUBJID, ~PARAMCD, ~AVALC, ~ADT, ~ANL01FL, "CDISCPILOT01", "01-701-1015", "OVR", "CR", "2016-01-25", "Y", "CDISCPILOT01", "01-701-1015", "OVR", "SD", "2016-02-22", NA_character_, "CDISCPILOT01", "01-701-1015", "OVR", "PD", "2016-02-22", "Y", "CDISCPILOT01", "01-701-1015", "BOR", "CR", "2016-01-25", "Y", "CDISCPILOT01", "01-701-1034", "OVR", "SD", "2015-12-07", "Y", "CDISCPILOT01", "01-701-1034", "OVR", "PD", "2016-04-25", "Y", "CDISCPILOT01", "01-701-1034", "OVR", "PD", "2016-06-25", "Y", "CDISCPILOT01", "01-701-1034", "BOR", "SD", "2015-12-07", "Y", "CDISCPILOT01", "01-701-1035", "OVR", "SD", "2016-04-25", "Y", "CDISCPILOT01", "01-701-1035", "OVR", "PR", "2016-06-25", "Y", "CDISCPILOT01", "01-701-1035", "BOR", "PR", "2016-06-25", "Y", "CDISCPILOT01", "01-701-1015", "PD", "Y", "2016-02-22", "Y", "CDISCPILOT01", "01-701-1034", "PD", "Y", "2016-04-25", "Y" ) %>% mutate( ADT = as_date(ADT) ) pd <- date_source( dataset_name = "adrs", date = ADT, filter = PARAMCD == "PD" ) filter_pd( dataset = adrs, filter = PARAMCD == "OVR" & ANL01FL == "Y", source_pd = pd, source_datasets = list(adrs = adrs) ) # Filter OVR records up to first PD, first PD date derived from OVR records adrs <- tibble::tribble( ~STUDYID, ~USUBJID, ~PARAMCD, ~AVALC, ~ADT, ~ANL01FL, "CDISCPILOT01", "01-701-1015", "OVR", "CR", "2016-01-25", "Y", "CDISCPILOT01", "01-701-1015", "OVR", "SD", "2016-02-22", NA_character_, "CDISCPILOT01", "01-701-1015", "OVR", "PD", "2016-02-22", "Y", "CDISCPILOT01", "01-701-1015", "BOR", "CR", "2016-01-25", "Y", "CDISCPILOT01", "01-701-1034", "OVR", "SD", "2015-12-07", "Y", "CDISCPILOT01", "01-701-1034", "OVR", "PD", "2016-04-25", "Y", "CDISCPILOT01", "01-701-1034", "OVR", "PD", "2016-06-25", "Y", "CDISCPILOT01", "01-701-1034", "BOR", "SD", "2015-12-07", "Y", "CDISCPILOT01", "01-701-1035", "OVR", "SD", "2016-04-25", "Y", "CDISCPILOT01", "01-701-1035", "OVR", "PR", "2016-06-25", "Y", "CDISCPILOT01", "01-701-1035", "BOR", "PR", "2016-06-25", "Y" ) %>% mutate( ADT = as_date(ADT) ) pd <- date_source( dataset_name = "adrs", date = ADT, filter = PARAMCD == "OVR" & ANL01FL == "Y" & AVALC == "PD" ) filter_pd( dataset = adrs, filter = PARAMCD == "OVR" & ANL01FL == "Y", source_pd = pd, source_datasets = list(adrs = adrs) )library(dplyr) library(lubridate) library(admiral) # ensure that `date_source()` from admiralonco is used to avoid deprecation # warning unloadNamespace("admiralonco") library(admiralonco) # Filter OVR records up to first PD, first PD date provided in separate BDS dataset (adevent) adrs <- tibble::tribble( ~STUDYID, ~USUBJID, ~PARAMCD, ~AVALC, ~ADT, ~ANL01FL, "CDISCPILOT01", "01-701-1015", "OVR", "CR", "2016-01-25", "Y", "CDISCPILOT01", "01-701-1015", "OVR", "SD", "2016-02-22", NA_character_, "CDISCPILOT01", "01-701-1015", "OVR", "PD", "2016-02-22", "Y", "CDISCPILOT01", "01-701-1015", "BOR", "CR", "2016-01-25", "Y", "CDISCPILOT01", "01-701-1034", "OVR", "SD", "2015-12-07", "Y", "CDISCPILOT01", "01-701-1034", "OVR", "PD", "2016-04-25", "Y", "CDISCPILOT01", "01-701-1034", "OVR", "PD", "2016-06-25", "Y", "CDISCPILOT01", "01-701-1034", "BOR", "SD", "2015-12-07", "Y", "CDISCPILOT01", "01-701-1035", "OVR", "SD", "2016-04-25", "Y", "CDISCPILOT01", "01-701-1035", "OVR", "PR", "2016-06-25", "Y", "CDISCPILOT01", "01-701-1035", "BOR", "PR", "2016-06-25", "Y" ) %>% mutate( ADT = as_date(ADT) ) adevent <- tibble::tribble( ~STUDYID, ~USUBJID, ~PARAMCD, ~AVALC, ~ADT, "CDISCPILOT01", "01-701-1015", "PD", "Y", "2016-02-22", "CDISCPILOT01", "01-701-1034", "PD", "Y", "2016-04-25" ) %>% mutate( ADT = as_date(ADT) ) pd <- date_source( dataset_name = "adevent", date = ADT, filter = PARAMCD == "PD" ) filter_pd( dataset = adrs, filter = PARAMCD == "OVR" & ANL01FL == "Y", source_pd = pd, source_datasets = list(adevent = adevent) ) # Filter OVR records up to first PD, first PD date provided in ADSL dataset adsl <- tibble::tribble( ~STUDYID, ~USUBJID, ~PDDT, "CDISCPILOT01", "01-701-1015", "2016-02-22", "CDISCPILOT01", "01-701-1034", "2016-04-25", "CDISCPILOT01", "01-701-1035", "" ) %>% mutate( PDDT = as_date(PDDT) ) pd <- date_source( dataset_name = "adsl", date = PDDT ) filter_pd( dataset = adrs, filter = PARAMCD == "OVR" & ANL01FL == "Y", source_pd = pd, source_datasets = list(adsl = adsl) ) # Filter OVR records up to first PD, first PD date provided in input dataset (PD parameter) adrs <- tibble::tribble( ~STUDYID, ~USUBJID, ~PARAMCD, ~AVALC, ~ADT, ~ANL01FL, "CDISCPILOT01", "01-701-1015", "OVR", "CR", "2016-01-25", "Y", "CDISCPILOT01", "01-701-1015", "OVR", "SD", "2016-02-22", NA_character_, "CDISCPILOT01", "01-701-1015", "OVR", "PD", "2016-02-22", "Y", "CDISCPILOT01", "01-701-1015", "BOR", "CR", "2016-01-25", "Y", "CDISCPILOT01", "01-701-1034", "OVR", "SD", "2015-12-07", "Y", "CDISCPILOT01", "01-701-1034", "OVR", "PD", "2016-04-25", "Y", "CDISCPILOT01", "01-701-1034", "OVR", "PD", "2016-06-25", "Y", "CDISCPILOT01", "01-701-1034", "BOR", "SD", "2015-12-07", "Y", "CDISCPILOT01", "01-701-1035", "OVR", "SD", "2016-04-25", "Y", "CDISCPILOT01", "01-701-1035", "OVR", "PR", "2016-06-25", "Y", "CDISCPILOT01", "01-701-1035", "BOR", "PR", "2016-06-25", "Y", "CDISCPILOT01", "01-701-1015", "PD", "Y", "2016-02-22", "Y", "CDISCPILOT01", "01-701-1034", "PD", "Y", "2016-04-25", "Y" ) %>% mutate( ADT = as_date(ADT) ) pd <- date_source( dataset_name = "adrs", date = ADT, filter = PARAMCD == "PD" ) filter_pd( dataset = adrs, filter = PARAMCD == "OVR" & ANL01FL == "Y", source_pd = pd, source_datasets = list(adrs = adrs) ) # Filter OVR records up to first PD, first PD date derived from OVR records adrs <- tibble::tribble( ~STUDYID, ~USUBJID, ~PARAMCD, ~AVALC, ~ADT, ~ANL01FL, "CDISCPILOT01", "01-701-1015", "OVR", "CR", "2016-01-25", "Y", "CDISCPILOT01", "01-701-1015", "OVR", "SD", "2016-02-22", NA_character_, "CDISCPILOT01", "01-701-1015", "OVR", "PD", "2016-02-22", "Y", "CDISCPILOT01", "01-701-1015", "BOR", "CR", "2016-01-25", "Y", "CDISCPILOT01", "01-701-1034", "OVR", "SD", "2015-12-07", "Y", "CDISCPILOT01", "01-701-1034", "OVR", "PD", "2016-04-25", "Y", "CDISCPILOT01", "01-701-1034", "OVR", "PD", "2016-06-25", "Y", "CDISCPILOT01", "01-701-1034", "BOR", "SD", "2015-12-07", "Y", "CDISCPILOT01", "01-701-1035", "OVR", "SD", "2016-04-25", "Y", "CDISCPILOT01", "01-701-1035", "OVR", "PR", "2016-06-25", "Y", "CDISCPILOT01", "01-701-1035", "BOR", "PR", "2016-06-25", "Y" ) %>% mutate( ADT = as_date(ADT) ) pd <- date_source( dataset_name = "adrs", date = ADT, filter = PARAMCD == "OVR" & ANL01FL == "Y" & AVALC == "PD" ) filter_pd( dataset = adrs, filter = PARAMCD == "OVR" & ANL01FL == "Y", source_pd = pd, source_datasets = list(adrs = adrs) )
Get CR Records Followed by PR That Lead to a Prior Error
get_crpr_dataset()get_crpr_dataset()
Some {admiralonco} functions check that in the source records CR is not
followed by PR and throw an error otherwise. The get_crpr_dataset()
function allows one to retrieve the duplicate records that lead to an error.
Note that the function always returns the dataset of duplicates from the last
error that has been thrown in the current R session. Thus, after restarting
the R sessions get_crpr_dataset() will return NULL and after a second
error has been thrown, the dataset of the first error can no longer be
accessed (unless it has been saved in a variable).
A data.frame or NULL
Stefan Bundfuss
Utilities for Dataset Checking:
signal_crpr()
library(tibble) library(dplyr) library(lubridate) library(admiralonco) library(rlang) adrs <- tribble( ~USUBJID, ~ADTC, ~AVALC, "1", "2020-01-01", "PR", "1", "2020-02-01", "CR", "1", "2020-02-16", "NE", "1", "2020-03-01", "CR", "2", "2020-02-06", "PR", "2", "2020-02-16", "CR", "2", "2020-03-30", "PR", ) %>% mutate( ADT = ymd(ADTC), STUDYID = "XX1234" ) signal_crpr(adrs, order = exprs(ADT)) get_crpr_dataset()library(tibble) library(dplyr) library(lubridate) library(admiralonco) library(rlang) adrs <- tribble( ~USUBJID, ~ADTC, ~AVALC, "1", "2020-01-01", "PR", "1", "2020-02-01", "CR", "1", "2020-02-16", "NE", "1", "2020-03-01", "CR", "2", "2020-02-06", "PR", "2", "2020-02-16", "CR", "2", "2020-03-30", "PR", ) %>% mutate( ADT = ymd(ADTC), STUDYID = "XX1234" ) signal_crpr(adrs, order = exprs(ADT)) get_crpr_dataset()
These pre-defined event() and event_joined() objects can be used as input
to admiral::derive_extreme_event().
rsp_y no_data_n cb_y bor_cr bor_pr bor_sd bor_non_crpd bor_pd bor_ne no_data_missing crsp_y_cr crsp_y_pr cbor_cr cbor_prrsp_y no_data_n cb_y bor_cr bor_pr bor_sd bor_non_crpd bor_pd bor_ne no_data_missing crsp_y_cr crsp_y_pr cbor_cr cbor_pr
To see the definition of the various objects simply print the object in the
R console, e.g. bor_sd. For details of how to use these objects
please refer to admiral::derive_extreme_event().
It is assumed that dataset_name = "ovr" refers to the dataset of the only
overall response assessments at each visit which should be considered for the
parameter derivations. For example the dataset should include only
post-baseline assessments up to first PD and before start of anti-cancer
therapy.
admiral::derive_extreme_event(), admiral::event(), admiral::event_joined()
# This shows the definition of all pre-defined `event` objects that ship # with {admiralonco} exports <- sort(getNamespaceExports("admiralonco")) for (obj_name in exports) { obj <- getExportedValue("admiralonco", obj_name) if (inherits(obj, "event_def")) { cat("\n", obj_name, ":\n", sep = "") print(obj, indent = 2) } }# This shows the definition of all pre-defined `event` objects that ship # with {admiralonco} exports <- sort(getNamespaceExports("admiralonco")) for (obj_name in exports) { obj <- getExportedValue("admiralonco", obj_name) if (inherits(obj, "event_def")) { cat("\n", obj_name, ":\n", sep = "") print(obj, indent = 2) } }
Signal CR Records Followed by PR
signal_crpr( dataset, order, msg = "Dataset contains CR records followed by PR.", subject_keys = get_admiral_option("subject_keys"), check_type = "warning" )signal_crpr( dataset, order, msg = "Dataset contains CR records followed by PR.", subject_keys = get_admiral_option("subject_keys"), check_type = "warning" )
dataset |
A data frame |
order |
A list of variables created using |
msg |
The condition message |
subject_keys |
Variables to uniquely identify a subject A list of symbols created using |
check_type |
Type of message to issue when detecting PR after CR. Permitted Values: |
No return value, called for side effects
Stefan Bundfuss
Utilities for Dataset Checking:
get_crpr_dataset()
library(tibble) library(dplyr) library(lubridate) library(admiralonco) library(rlang) adrs <- tribble( ~USUBJID, ~ADTC, ~AVALC, "1", "2020-01-01", "PR", "1", "2020-02-01", "CR", "1", "2020-02-16", "NE", "1", "2020-03-01", "CR", "2", "2020-02-06", "PR", "2", "2020-02-16", "CR", "2", "2020-03-30", "PR", ) %>% mutate( ADT = ymd(ADTC), STUDYID = "XX1234" ) signal_crpr(adrs, order = exprs(ADT))library(tibble) library(dplyr) library(lubridate) library(admiralonco) library(rlang) adrs <- tribble( ~USUBJID, ~ADTC, ~AVALC, "1", "2020-01-01", "PR", "1", "2020-02-01", "CR", "1", "2020-02-16", "NE", "1", "2020-03-01", "CR", "2", "2020-02-06", "PR", "2", "2020-02-16", "CR", "2", "2020-03-30", "PR", ) %>% mutate( ADT = ymd(ADTC), STUDYID = "XX1234" ) signal_crpr(adrs, order = exprs(ADT))