
Parse mixed-format date strings into structured ISO-8601 output
Source:R/date_parser.R
parse_dates.RdConverts a character vector of date strings in mixed formats into a standardised 5-column tibble. Handles ISO, MDY, DMY, SAS (dBY), YYYYMMDD compact, year-only, and month-year formats via lubridate::parse_date_time() with train=FALSE (required for heterogeneous columns).
Usage
parse_dates(raw_dates, orig_row_id = seq_along(raw_dates))Value
A tibble with 5 columns:
- orig_row_id
Integer row position for join-by-position merge.
- raw_date
Original input string, preserved for audit.
- parsed_date
ISO-8601 "YYYY-MM-DD" string, or NA_character_ if unparseable.
- date_year
Integer year extracted from parsed_date, or NA_integer_.
- date_flag
One of: "" (clean), "partial", "inferred_format", "ambiguous", "unparseable".