Determines whether a given R object is a forecast object or not. An R object is a forecast object if:
Details
It is a list (and also not a data frame)
It has a
name
field (may beNULL
)It has a
forecast_time
field (may beNULL
)It has a
data
field
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