This function validates a line against a specified format pattern and prints/logs detailed errors for each field that does not match the expected format.

printValidationError(
  line,
  validation,
  file = NA,
  line_number = NA,
  log_file = NULL
)

Arguments

line

A character vector representing the line to be validated.

file

(Optional) The name of the file containing the line (default is NA).

line_number

(Optional) The line number within the file (default is NA).

log_file

(Optional) A character vector specifying a file where error messages are logged. If NULL, messages are only printed to the console.

Value

NULL (This function is called for its side effect of printing/logging messages.)

Examples

printValidationError ("NS-20220510-001 68.37261219N 18.69783 1195.186 O", "data.txt", 5, "log/validation.txt", "log/warnings.txt")
#> Error: $ operator is invalid for atomic vectors