Skip to contents

Determines whether a given R object is a forecast object or not. An R object is a forecast object if:

Usage

is_forecast(fcst)

Arguments

fcst

An R object

Value

TRUE if fcst is a forecast object, FALSE otherwise

Details

  • It is a list (and also not a data frame)

  • It has a name field (may be NULL)

  • It has a forecast_time field (may be NULL)

  • 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