business-science / anomalize

Tidy anomaly detection
https://business-science.github.io/anomalize/
338 stars 60 forks source link

Error in stats::stl(., s.window = "periodic", t.window = trnd, robust = TRUE) : #25

Open willmills73 opened 5 years ago

willmills73 commented 5 years ago

First of all, thanks for an awesome package -very useful! I'm getting an error on some of the data sets I'm running and not sure what's the best way to handle it. The input data is: date observation 2019-01-02 35 2019-01-03 54 2019-01-04 48 2019-01-05 2 2019-01-06 3 2019-01-07 44 2019-01-08 67 2019-01-09 47 2019-01-10 53 2019-01-11 47 2019-01-12 0 2019-01-14 41 2019-01-15 67 2019-01-16 61 2019-01-17 58 2019-01-18 52 2019-01-19 3

I read the data and convert to tible: cur_tbl <- as.tibble(myInput) and then I run the following (which works perfectly on other sets): cur_tbl %>% time_decompose(observation, message = TRUE) %>% anomalize(remainder, method = method, alpha = alpha) %>% time_recompose()) It returns error: Converting from tbl_df to tbl_time. Auto-index message: index = inq_day frequency = 1 days trend = 17 days Error in stats::stl(., s.window = "periodic", t.window = trnd, robust = TRUE) : series is not periodic or has less than two periods

I read this might be due to duplicated dates, but I don't have that issue. Any help is greatly appreciated.

Thank you!