business-science/sweep

Error in .f(.x[[i]], ...) : y should be a univariate time series

edgBR opened this issue · 0 comments

edgBR commented

Dear @mdancho84,

I am triying to forecast multiple time series across 3 groups. My original dataframe looks like this:

test
# A tibble: 4,282 x 4
# Groups:   product, measurement_type, instrumentation_type [4,282]
     product measurement_type instrumentation_type data         
   <chr>               <dbl>  <dbl> <list>            
 1 XXXXXX                42      1 <tibble [495 × 2]>

My target column of the tibble dataframe is snsr_val and is part of the tibble [records x columns]

Whenever I map the data_frame as:


data_ts <- test %>%
  mutate(data.ts = map(.x       = data, 
                       .f       = tk_ts,
                       freq     = 52))

I am not using any start as the timeseries are not regular (different starting and ending date). However when I am trying to fit a model I am getting the following error:

Error in .f(.x[[i]], ...) : y should be a univariate time series

Is there any way to map the fitting function to multiple groups?