Applies the selected type of datacut on each SDTM dataset based on the selected SDTM date variable, and outputs the resulting cut datasets. It also provides an option to perform a "special" cut on the demography (dm) domain in which any deaths occurring after the datacut date will be removed.
Usage
process_cut(
source_sdtm_data,
patient_cut_v,
date_cut_m,
no_cut_v,
dataset_cut,
cut_var,
special_dm = TRUE
)
Arguments
- source_sdtm_data
A list of uncut SDTM dataframes
- patient_cut_v
A vector of quoted SDTM domain names in which a patient cut should be applied
- date_cut_m
A 2 column matrix, where the first column is the quoted SDTM domain names in which a date cut should be applied and the second column is the quoted SDTM date variables used to carry out the date cut for each SDTM domain.
- no_cut_v
A vector of quoted SDTM domain names in which no cut should be applied
- dataset_cut
Input datacut dataset, e.g. dcut
- cut_var
Datacut date variable within the dataset_cut dataset, e.g. DCUTDTM
- special_dm
A logical input indicating whether the "special dm cut" should be performed. Note that, if TRUE, there is no need to specify dm in patient_cut_v, date_cut_m or no_cut_v
Value
Returns a list of all input SDTM datasets, plus the DCUT dataset, after performing the selected datacut on each domain.
Examples
library("dplyr")
#>
#> Attaching package: ‘dplyr’
#> The following objects are masked from ‘package:lubridate’:
#>
#> intersect, setdiff, union
#> The following objects are masked from ‘package:stats’:
#>
#> filter, lag
#> The following objects are masked from ‘package:base’:
#>
#> intersect, setdiff, setequal, union
dcut <- data.frame(
USUBJID = factor(c("a", "b"), levels = c("a", "b", "c")),
DCUTDTC = c("2022-02-17", "2022-02-17")
) %>%
impute_dcutdtc(DCUTDTC, DCUTDTM)
sc <- data.frame(USUBJID = c("a", "a", "b", "c"))
ts <- data.frame(USUBJID = c("a", "a", "b", "c"))
ae <- data.frame(
USUBJID = c("a", "a", "b", "c"),
AESTDTC = c("2022-02-16", "2022-02-18", "2022-02-16", "2022-02-16")
)
dm <- data.frame(
USUBJID = c("a", "b", "c"),
DTHDTC = c("2022-02-14", "2022-02-22", "2022-02-16"),
DTHFL = c("Y", "Y", "Y")
)
source_data <- list(sc = sc, ae = ae, dm = dm, ts = ts)
process_cut(
source_sdtm_data = source_data,
patient_cut_v = c("sc"),
date_cut_m = rbind(c("ae", "AESTDTC")),
no_cut_v = c("ts"),
dataset_cut = dcut,
cut_var = DCUTDTM,
special_dm = TRUE
)
#> Error in lapply(source_data, is.data.frame): object 'source_data' not found