Difficulty implementing time series cross-validation with forecast package in R
Hey everyone, I'm running into an issue that's driving me crazy..... I'm upgrading from an older version and I'm trying to implement time series cross-validation using the `forecast` package in R, but I'm running into issues with the `tsCV` function. Specifically, when I try to use it with my time series data, I'm getting the following behavior: `behavior in tsCV(y, forecastfunction, h = h, ...) : 'y' must be a numeric vector or time series object`. My dataset is a simple time series of monthly sales data, and I've already converted it into a `ts` object. Hereβs a snippet of my code: ```r library(forecast) # Example sales data data <- c(100, 120, 150, 130, 160, 170, 180, 200) # Convert to time series object timeseries <- ts(data, frequency = 12, start = c(2020, 1)) # Define a simple forecasting function forecast_function <- function(x) { return(forecast(auto.arima(x), h = 1)) } # Attempting cross-validation cv_results <- tsCV(timeseries, forecast_function, h = 1) ``` Iβve confirmed that my `timeseries` object is indeed a `ts` object by running `class(timeseries)`, which returns `"ts"`. However, it seems that `tsCV` is not recognizing it as such. Iβve also tried running the function with a simple numeric vector instead, but I received the same behavior. Any suggestions on how to resolve this or what I might be missing? I'm using R version 4.1.0 and the `forecast` package version 8.15. I'm coming from a different tech stack and learning R. Am I missing something obvious? Any ideas how to fix this?