business-science/anomalize

What happens when trend is "2 weeks"?

charlie-gallagher opened this issue · 1 comments

When decomposing data, you get a slew of warnings when you set "trend" to "2 weeks" (or N weeks). This is because lubridate::floor_date doesn't allow you to return multi-week floors. Instead it returns the closest week floor.

How does this affect time_decompose? Would it create spurious data?

library(tidyverse)
library(anomalize)

tidyverse_cran_downloads %>%
  time_decompose(count, method = "stl", frequency = "auto", trend = "2 weeks")

This is a lubridate issue, where 2 weeks doesn't allow. It might be best to specify in days.