% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/utils.R
\name{ensure_horizon_schema}
\alias{ensure_horizon_schema}
\title{Coerce a horizons-like data.frame to the canonical schema}
\usage{
ensure_horizon_schema(h)
}
\arguments{
\item{h}{Input data.frame or data.table.}
}
\value{
A \code{data.table} with the canonical horizon columns present, in
  canonical order, with extra columns preserved at the end.
}
\description{
Adds 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.
}
\examples{
h <- ensure_horizon_schema(data.frame(top_cm = 0, bottom_cm = 20))
"designation" \%in\% names(h)
}
