
Validate econanalyzr tibble structure
Source:R/utils-check_econanalyzr_df.R
check_econanalyzr_df.RdEnforces the econanalyzr schema:
First 9 required columns with exact names and expected low-level type & primary class:
date (Date/double),date_period_text (character),value (numeric/double),data_element_text (character),data_measure_text (character),date_measure_text (character),data_transform_text (character),geo_entity_type_text (character),geo_entity_text (character).Any number of optional columns may appear after the first 9.
The final column must be
viz_type_textof type/classcharacter.
Details
If all required columns and viz_type_text are present but out of order, the function
emits a warning and reorders the columns to: required 9 (in order) → optional(s) → viz_type_text.
Special handling of date:
Accepts base
Dateand subclasses. Subclasses are coerced to plainDatewith a warning.Accepts
zoo::yearmon/zoo::yearqtr(ifzoois installed) and always coerces toDateat the start of the period (first day of the month/quarter) with a warning.Accepts
POSIXct/POSIXltand coerces toDate(drop time) usingdatetime_tz.
Special handling of value:
Must be double; if numeric but not double (e.g., integer or other numeric class), the column is coerced to double with a warning. Non-numeric is an error.
To support yearmon/yearqtr, add zoo to Suggests. If a yearmon/yearqtr column is
encountered and zoo is not installed, a classed error is raised with guidance.