
Coerce a horizons-like data.frame to the canonical schema
Source:R/utils.R
ensure_horizon_schema.RdAdds any missing canonical columns as NAs of the right type and reorders canonical columns first. Extra user-supplied columns are preserved at the end. Coerces character values to numeric where the schema requires it.
Value
A data.table with the canonical horizon columns present, in
canonical order, with extra columns preserved at the end.
Examples
h <- ensure_horizon_schema(data.frame(top_cm = 0, bottom_cm = 20))
"designation" %in% names(h)
#> [1] TRUE