Closed bearloga closed 5 years ago
Hi @bearloga, looks like this is because you use "date"
rather than date
. Sorry for the pain this caused you as the error catching here isn't great. That's my fault.
library(anomalize)
library(tibbletime)
#>
#> Attaching package: 'tibbletime'
#> The following object is masked from 'package:stats':
#>
#> filter
library(magrittr)
x <- structure(
list(
date = structure(c(16344, 16345, 16346, 16347,
16348, 16349, 16350, 16351, 16352, 16353, 16354, 16355, 16356,
16357, 16358, 16359, 16360, 16361, 16362, 16363, 16364),
class = "Date"),
installs = c(23350L, 23154L, 22785L, 24356L, 24234L, 22774L,
22978L, 23028L, 22708L, 23510L, 25631L, 24591L, 22854L, 22540L,
24313L, 24717L, 24169L, 26092L, 25254L, 23041L, 24170L)
),
row.names = c(NA, -21L), class = c("tbl_df", "tbl", "data.frame")
)
x_anomalized <- x %>%
as_tbl_time(date) %>%
time_decompose(installs) %>%
anomalize(remainder) %>%
time_recompose()
#> frequency = 5.5 days
#> trend = 21 days
x_anomalized
#> # A time tibble: 21 x 10
#> # Index: date
#> date observed season trend remainder remainder_l1 remainder_l2
#> <date> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 2014-10-01 23350 175. 23133. 42.1 -4592. 4750.
#> 2 2014-10-02 23154 -92.7 23187. 59.5 -4592. 4750.
#> 3 2014-10-03 22785 -92.7 23241. -364. -4592. 4750.
#> 4 2014-10-04 24356 -150. 23296. 1210. -4592. 4750.
#> 5 2014-10-05 24234 -150. 23357. 1027. -4592. 4750.
#> 6 2014-10-06 22774 -55.2 23418. -589. -4592. 4750.
#> 7 2014-10-07 22978 175. 23479. -676. -4592. 4750.
#> 8 2014-10-08 23028 -92.7 23539. -418. -4592. 4750.
#> 9 2014-10-09 22708 -92.7 23599. -798. -4592. 4750.
#> 10 2014-10-10 23510 -150. 23659. 1.47 -4592. 4750.
#> # ... with 11 more rows, and 3 more variables: anomaly <chr>,
#> # recomposed_l1 <dbl>, recomposed_l2 <dbl>
Created on 2018-11-12 by the reprex package (v0.2.0).
Ohhhhhh. Oops, my bad also. Thank you very much for clarification @DavisVaughan!
Hello! I'm having problems using my own data with the package. Here's a little bit of the data for example:
When I run:
I get:
The problem appears to be at the very first step with
time_decompose()
. This is mysessionInfo()
:Please help. I compared my data with
tidyverse_cran_downloads
and I cannot figure out what I'm missing. Thank you!