load_expanded_data | R Documentation |
load_expanded_data(
object,
p_control = NULL,
period = NULL,
subset_condition = NULL,
seed = NULL
)
## S4 method for signature 'trial_sequence'
load_expanded_data(
object,
p_control = NULL,
period = NULL,
subset_condition = NULL,
seed = NULL
)
object |
An object of class trial_sequence. |
p_control |
Probability of selecting a control, |
period |
An integerish vector of non-zero length to select trial period(s) or |
subset_condition |
A string or The operators Note: Make sure numeric vectors written as |
seed |
An integer seed or Note: The same seed will return a different result depending on the class of the te_datastore object contained in the trial_sequence object. |
This method is used on trial_sequence objects to read, subset and sample expanded data.
An updated trial_sequence object, the data is stored in slot @outcome_data
as a te_outcome_data object.
# create a trial_sequence-class object
trial_itt_dir <- file.path(tempdir(), "trial_itt")
dir.create(trial_itt_dir)
trial_itt <- trial_sequence(estimand = "ITT") |>
set_data(data = data_censored) |>
set_outcome_model(adjustment_terms = ~ x1 + x2)
trial_itt_csv <- set_expansion_options(
trial_itt,
output = save_to_csv(file.path(trial_itt_dir, "trial_csvs")),
chunk_size = 500
) |>
expand_trials()
# load_expanded_data default behaviour returns all trial_periods and doesn't sample
load_expanded_data(trial_itt_csv)
# load_expanded_data can subset the data before sampling
load_expanded_data(
trial_itt_csv,
p_control = 0.2,
period = 1:20,
subset_condition = "followup_time %in% 1:20 & x2 < 1",
)
# delete after use
unlink(trial_itt_dir, recursive = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.