Determines whether a given R object is a forecast object or not.
Details
An R object is a forecast object if:
It is a list (and also not a data frame)
It has a
namefield (may beNULL)It has a
forecast_timefield (may beNULL)It has a
datafield
is_forecast() does NO further input validation beyond this.
For a version of the function that does input validation, see is_valid_forecast().
Examples
# FALSE
casteval:::is_forecast(5)
#> [1] FALSE
casteval:::is_forecast(data.frame(time=1, val=2))
#> [1] FALSE
# TRUE
casteval:::is_forecast(list(name=NULL, forecast_time=NULL, data=NULL))
#> [1] TRUE