library(tibble)
library(dplyr, warn.conflicts = FALSE)
library(lubridate)
# Derive a new parameter for measurable disease at baseline
adsl <- tribble(
~USUBJID,
"1",
"2",
"3"
) %>%
mutate(STUDYID = "XX1234")
tu <- tribble(
~USUBJID, ~VISIT, ~TUSTRESC,
"1", "SCREENING", "TARGET",
"1", "WEEK 1", "TARGET",
"1", "WEEK 5", "TARGET",
"1", "WEEK 9", "NON-TARGET",
"2", "SCREENING", "NON-TARGET",
"2", "SCREENING", "NON-TARGET"
) %>%
mutate(
STUDYID = "XX1234",
TUTESTCD = "TUMIDENT"
)
derive_param_exist_flag(
dataset_ref = adsl,
dataset_add = tu,
filter_add = TUTESTCD == "TUMIDENT" & VISIT == "SCREENING",
condition = TUSTRESC == "TARGET",
false_value = "N",
missing_value = "N",
set_values_to = exprs(
AVAL = yn_to_numeric(AVALC),
PARAMCD = "MDIS",
PARAM = "Measurable Disease at Baseline"
)
)
Run the code above in your browser using DataLab