Extract information from CSV headers.

extract_header_info(
  header_lines,
  label,
  filename,
  required = FALSE,
  multiline = FALSE
)

Arguments

header_lines

Character vector holding raw header lines

label

Label to search for - character

filename

Filename (for error reporting purposes)

required

Is this label required? (logical)

multiline

Can this label hold multi-line information? (logical)

Value

Extracted label information, as a character vector

Details

CSV files can have headers, commented lines of the form "# Title: xxxx", "# Source: xxxx", etc. Extract this information if present. Note that empty headers are not allowed. This function is called by parse_csv_header.