Check file integrity and required columns
check_file_integrity.RdValidates file existence and format, checks for required columns in the data, and optionally previews data structure.
Usage
check_file_integrity(
file_path,
required_vars = c("UA", "UD", "FA", "FD", "treatment"),
verbose = TRUE
)Value
Returns the detected file format string ("csv" or "excel") invisibly if validation passes. Throws an error if validation fails.
Details
The function performs the following checks:
File exists and is readable
File format is supported (.csv, .xlsx, .xls)
All required columns are present
Examples
if (FALSE) { # \dontrun{
# Check a CSV file
check_file_integrity("data.csv")
# Check with custom required variables
check_file_integrity("data.csv",
required_vars = c("UA", "UD", "FA", "FD", "treatment", "my_new_variable"))
} # }