Skip to contents

Removes rows from forecast data frame which should not be scored, i.e. the data generated for dates/times prior to when the forecast was created.

Usage

filter_forecast_time(df, forecast_time)

Arguments

df

The forecast data frame. See ?create_forecast for details

forecast_time

Either NULL or a time of the same type as the values in dat$time. If non-NULL, all rows with time prior to forecast_time will be removed from dat.

Value

The filtered data frame (no change if forecast_time NULL)

Examples

# data.frame(time=5:10, val=15:20)
casteval:::filter_forecast_time(data.frame(time=1:10, val=11:20), 5)
#>   time val
#> 1    5  15
#> 2    6  16
#> 3    7  17
#> 4    8  18
#> 5    9  19
#> 6   10  20

# unchanged
casteval:::filter_forecast_time(data.frame(time=1:10, val=11:20), NULL)
#>    time val
#> 1     1  11
#> 2     2  12
#> 3     3  13
#> 4     4  14
#> 5     5  15
#> 6     6  16
#> 7     7  17
#> 8     8  18
#> 9     9  19
#> 10   10  20