is_forecast: Test whether an object is a forecast object

View source: R/forecast.R

is_forecastR Documentation

Test whether an object is a forecast object

Description

Generic function to test whether an object is of class ⁠forecast_*⁠. You can also test for a specific ⁠forecast_*⁠ class using the appropriate ⁠is_forecast.forecast_*⁠ method. For example, to check whether an object is of class forecast_quantile, you would use scoringutils:::is_forecast.forecast_quantile().

Usage

is_forecast(x, ...)

## Default S3 method:
is_forecast(x, ...)

## S3 method for class 'forecast_sample'
is_forecast(x, ...)

## S3 method for class 'forecast_binary'
is_forecast(x, ...)

## S3 method for class 'forecast_point'
is_forecast(x, ...)

## S3 method for class 'forecast_quantile'
is_forecast(x, ...)

Arguments

x

An R object.

...

Additional arguments

Value

TRUE if the object is of class ⁠forecast_*⁠, FALSE otherwise.

Examples

forecast_binary <- as_forecast(example_binary)
is_forecast(forecast_binary)

epiforecasts/scoringutils documentation built on April 23, 2024, 4:56 p.m.