I am performing a simple seasonal adjustment.
Here is the code that works ok.
library(seasonal) library(purrr) datos <- ts(rnorm(700), frequency = 12,start = 1960) ajuste <- seas(datos, arima.model = c(0, 1, 1,0, 1, 1)) ajuste
But after running the code from above, I tried a loop with map.
I defined the arima models in a list.
When I run map using seas and arima model, It fails.
regresion_list <- list("c(1 1 1,0 1 1)","c(3 1 2,0 1 3)") aj_map <- map(regresion_list, ~ seas(datos, arima.model = .x))
I know the reason.
Each element from regresion_list is recognized as character and not numeric:
str(c(0, 1, 1,0, 1, 1)) str(regresion_list)
I just don't know how to tell inside map that each element from .x or regresion_list is a numeric vector and not a character one.
Can you help me?
Thanks for your time and interest.
Have a nice week.