Error when using autoplot() with forecast and fable objects

Trying to run the example in Section 9.7 of fpp3 I get the error message below:


-The script is run with only fpp3 library loaded

  • I am using R 4.4.1 (note that some packages loaded by fpp3 are built with R 4.4.3)
  • I get the same error with my personal scripts while attempting to use autoplot with forecast objects.
    -The problem should be related to update of the R system or its library, because with my previous installation both fpp3 examples and my scripts were working with no problem. Unfortunately I have no recollection of the library versions in my previous installation, which anyway should have been based on R 3.6|

I attach the full R code, which anyway is just copied from online version of fpp3:

R code

library(fpp3)

global_economy |>
filter(Code == "CAF") |>
gg_tsdisplay(difference(Exports), plot_type='partial')

augment(caf_fit) |>
filter(.model=='search') |>
features(.innov, ljung_box, lag = 10, dof = 3)

caf_fit <- global_economy |>
filter(Code == "CAF") |>
model(arima210 = ARIMA(Exports ~ pdq(2,1,0)),
arima013 = ARIMA(Exports ~ pdq(0,1,3)),
stepwise = ARIMA(Exports),
search = ARIMA(Exports, stepwise=FALSE))

caf_fit |>
select(search) |>
gg_tsresiduals()

augment(caf_fit) |>
filter(.model=='search') |>
features(.innov, ljung_box, lag = 10, dof = 3)

caf_fit |>
forecast(h=5) |>
filter(.model=='search') |>
autoplot(global_economy)

The R package versions also matter, and are often more important than the version of R being used. I cannot reproduce this error using R4.5.2 and the latest packages on CRAN.

Try updating all your packages to the latest CRAN versions, then start a new R session. You can see what package versions we use in the book at Forecasting: Principles and Practice (3rd ed)

Thank you for quick help. You are right: the issue should be related to the R version 4.4.1 or the package I have used to install it. I have gone back to R 4.3.1 and everything works fine! I will upgrade to version 4.5.2 in the next days.
best regards
Floriano

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.