te_datastore_csv-class: te_datastore_csv, functions and methods

te_datastore_csv-classR Documentation

te_datastore_csv, functions and methods

Description

This method is used internally by expand_trials to save the data to the "datastore" defined in set_expansion_options.

Usage

## S4 method for signature 'te_datastore_csv'
save_expanded_data(object, data)

## S4 method for signature 'te_datastore_csv'
read_expanded_data(object, period = NULL, subset_condition = NULL)

## S4 method for signature 'te_datastore_csv'
sample_expanded_data(
  object,
  p_control,
  period = NULL,
  subset_condition = NULL,
  seed
)

Arguments

object

An object of class te_datastore or a child class.

data

A data frame containing the expanded trial data. The columns trial_period and id are present, which may be used in methods to save the data in an optimal way, such as with indexes, keys or separate files.

period

An integerish vector of non-zero length to select trial period(s) or NULL (default) to select all files.

subset_condition

A string of length 1 or NULL (default).

Value

A 'te_datastore_csv' object.

Slots

path

path to csv files.

files

names of csv files.

template

data.frame template.

Examples

temp_dir <- tempfile("csv_dir_")
dir.create(temp_dir)
datastore <- save_to_csv(temp_dir)
data(vignette_switch_data)
save_expanded_data(datastore, vignette_switch_data[1:200, ])

# delete after use
unlink(temp_dir, recursive = TRUE)

CAM-Roche/RandomisedTrialsEmulation documentation built on April 14, 2025, 7:44 a.m.