derive_param_response {admiralonco} | R Documentation |
Adds a parameter indicating if a response has been observed.
If a response has been observed, AVALC
is set to "Y", AVAL
to 1 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", AVAL
to 0 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")
)
dataset |
Input dataset The variables specified by the After applying |
dataset_adsl |
Input dataset
|
filter_source |
Source filter All observations in the |
source_pd |
Sources and conditions defining the end of the assessment period for the responses. An object of type All observations in
|
source_datasets |
Source dataset A named list of datasets with one element is expected
(e.g. The name must match the The variables specified by the |
set_values_to |
Variables to set A named list returned by The values must be symbols, character strings, numeric values or |
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. |
subject_keys |
Variables to uniquely identify a subject A list of symbols created using |
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"
, AVAL
to 1
, and
ADT
to the first date (ADT
) where the response condition is fulfilled.
For all other subjects AVALC
is set to "N"
, AVAL
to 0
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
ADRS Functions for adding Parameters:
derive_param_bor()
,
derive_param_clinbenefit()
,
derive_param_confirmed_bor()
,
derive_param_confirmed_resp()
library(dplyr)
library(admiral)
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)