tidyverts / fable

Tidy time series forecasting
https://fable.tidyverts.org
GNU General Public License v3.0
564 stars 66 forks source link

ETS() and ARIMA() don't like columns named "int" #396

Open deepayan opened 1 year ago

deepayan commented 1 year ago

This works:

as_tsibble(co2) |> model(ETS(value))

This fails in a very confusing way:

as_tsibble(co2) |> mutate(int = rnorm(468)) |> model(ETS(value))
# # A mable: 1 x 1
#   `ETS(value)`
#        <model>
# 1 <NULL model>
# Warning message:
# 1 error encountered for ETS(value)
# [1] In argument: `.gaps = (length(seq_generator(index, int)) - length(index)) > 0`.

This is triggered by the mere presence of a variable name "int"; same for ARIMA() as well, though not TSLM().

The problem is presumably somewhere in https://github.com/tidyverts/tsibble/blob/main/R/gaps.R.

Package versions:

other attached packages:
 [1] fable_0.3.3       feasts_0.3.1      fabletools_0.3.3  tsibbledata_0.4.1
 [5] tsibble_1.1.3     ggplot2_3.4.2     lubridate_1.8.0   tidyr_1.1.3      
 [9] dplyr_1.1.0       tibble_3.0.4      fpp3_0.5         

loaded via a namespace (and not attached):
 [1] gtable_0.3.0         compiler_4.4.0       crayon_1.3.4        
 [4] tidyselect_1.2.0     Rcpp_1.0.10          scales_1.2.1        
 [7] R6_2.5.0             generics_0.1.3       distributional_0.3.2
[10] munsell_0.5.0        pillar_1.8.1         rlang_1.1.0         
[13] utf8_1.1.4           cli_3.6.0            progressr_0.9.0     
[16] withr_2.5.0          magrittr_2.0.1       digest_0.6.27       
[19] grid_4.4.0           rstudioapi_0.13      rappdirs_0.3.3      
[22] lifecycle_1.0.3      anytime_0.3.9        vctrs_0.5.2         
[25] glue_1.4.2           farver_2.0.3         fansi_0.4.1         
[28] colorspace_2.0-0     purrr_0.3.4          tools_4.4.0         
[31] pkgconfig_2.0.3      ellipsis_0.3.1