This article is an example workflow of the wrapped approach where modules are wrapped into a cut_data function.
# Name: Datacut Template Code - Modular Approach
# Creating data to be cut ------------------------------------------------
library(datacutr)
library(admiraldev)
library(dplyr)
library(lubridate)
library(stringr)
library(purrr)
# Name: Datacut Template Code - Wrapped Approach
# Creating data to be cut ------------------------------------------------
<- list(ds = datacutr_ds, dm = datacutr_dm, ae = datacutr_ae, sc = datacutr_sc, lb = datacutr_lb, fa = datacutr_fa, ts = datacutr_ts)
source_data
# Create DCUT ------------------------------------------------------------
<- create_dcut(
dcut dataset_ds = source_data$ds,
ds_date_var = DSSTDTC,
filter = DSDECOD == "RANDOMIZATION",
cut_date = "2022-06-04",
cut_description = "Clinical Cutoff Date"
)
# Pre-processing of FA ----------------------------------------------------
# Update FA
$fa <- source_data$fa %>%
source_datamutate(DCUT_TEMP_FAXDTC = case_when(
!= "" ~ FASTDTC,
FASTDTC != "" ~ FADTC,
FADTC TRUE ~ as.character(NA)
))
# Process data cut --------------------------------------------------------
<- process_cut(
cut_data source_sdtm_data = source_data,
patient_cut_v = c("sc", "ds"),
date_cut_m = rbind(
c("ae", "AESTDTC"),
c("lb", "LBDTC"),
c("fa", "DCUT_TEMP_FAXDTC")
),no_cut_v = c("ts"),
dataset_cut = dcut,
cut_var = DCUTDTM,
special_dm = TRUE
)