This helper function writes data to CSV files and/or database based on the configuration. Useful for large-scale cloud compute where CSV files may be unnecessary when using database storage.
write_csv_and_db(
data,
csv_path,
csv_enabled = TRUE,
db_con = NULL,
data_type = NULL,
sub = NULL,
ses = NULL,
task = NULL,
run = NULL,
eye_suffix = NULL,
epoch_label = NULL,
verbose = FALSE
)Logical indicating success
Data frame to write
Full path where CSV file should be written (ignored if csv_enabled = FALSE)
Whether to write CSV files (defaults to TRUE for backward compatibility)
Database connection (NULL if not enabled)
Type of data ("timeseries", "epochs", "epoch_timeseries", "epoch_summary", "events", "blinks", "confounds")
Subject ID
Session ID
Task name
Run number (optional)
Eye suffix for binocular data (optional)
Epoch label for epoched data (optional, used in table naming)
Whether to print verbose output