This function loads trial results from a specified file and optionally cleans the data. It ensures that the file exists, loads the data into memory, and applies basic cleaning steps such as standardizing column names and removing location-related columns, if cleaning is enabled.
load_trial_results(trial_results_path, cleaning = TRUE)A string specifying the file path to the trial results file. The file must exist and be a valid R data file.
A logical value indicating whether to clean the loaded data. Defaults to `TRUE`. If `TRUE`, column names are standardized to snake_case, and columns matching "location" are removed.
A data frame containing the trial results, optionally cleaned.
# Load and clean trial results
trial_data <- load_trial_results("path/to/trial_results.RData")
#> Error in load_trial_results("path/to/trial_results.RData"): File not found: path/to/trial_results.RData
# Load trial results without cleaning
trial_data <- load_trial_results("path/to/trial_results.RData", cleaning = FALSE)
#> Error in load_trial_results("path/to/trial_results.RData", cleaning = FALSE): File not found: path/to/trial_results.RData