This function reads a file line by line and validates each line against a specified format pattern. It prints and optionally logs error messages for lines that do not match the expected format.

validateFile(
  file_path,
  silent = FALSE,
  validator,
  log_file = "log/error.log",
  head = FALSE
)

Arguments

file_path

A character vector representing the path to the file to be validated.

Value

A logical vector where each element indicates whether the corresponding line in the file matches the specified format pattern.

Examples

validateFile("data.txt")
#> Warning: cannot open file 'data.txt': No such file or directory
#> Error reading file: data.txt 
#> Error in validateFile("data.txt"): argument "validator" is missing, with no default