问题:我有以下 R 代码(如下):它不适用于“my.list”中的“x”=“ARIMA”和“ETS”。这就是问题所在:“fabletools::model(arima_auto = fable::ARIMA(Trips))”= 它可以工作,但是这个:“fabletools::model(arima_auto = fable::x(Trips))”没有用。有谁知道我的问题的解决方案。在R中甚至可能吗?
library(tidyverse)
library(fable)
library(fabletools)
library(tsibble)
tourism <- tsibble::tourism
my.list <- list("ARIMA","ETS")
my.list[[1]] ## "ARIMA"
my.list[[2]] ## "ETS"
f_test <- function(.df1,.n){
x <- .df1[[.n]][[1]] ### 1) "ARIMA", "ETS"
print(x)
fit <- tourism %>%
dplyr::filter(Region == "Adelaide") %>%
#fabletools::model(arima_auto = fable::ARIMA(Trips)) ### it works
fabletools::model(arima_auto = fable::x(Trips)) ### didn't work
assign("fit", fit, envir= globalenv())
}
purrr::map(.x = seq(my.list), .f = ~(f_test(my.list, Counter <- .x)))