tidyverts / fabletools

General fable features useful for extension packages
http://fabletools.tidyverts.org/
89 stars 31 forks source link

Environment dataset names before column names #201

Closed alexanderjwhite closed 4 years ago

alexanderjwhite commented 4 years ago

fable appears to look at the dataset names before column names in the environment. This is an issue if a dataset has the same name as a column that one is trying to build a model around. Of course, best practice coding (which I clearly wasn't following when I found this) should prevent it from occurring. That being said, it seems like fable should look at the column names first.

Working

library(dplyr)
eu_retail <- tsibble::as_tsibble(fpp2::euretail)
fit <- eu_retail %>%
  fabletools::model(arima = fable::ARIMA(value))

Not working

library(dplyr)
value <- tsibble::as_tsibble(fpp2::euretail)
fit <- value %>%
  fabletools::model(arima = fable::ARIMA(value))

sessionInfo() R version 3.6.1 (2019-07-05) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 17134)

Matrix products: default

locale: [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] dplyr_0.8.5

loaded via a namespace (and not attached): [1] Rcpp_1.0.4.6 urca_1.3-0 cla_0.0.0.9000 pillar_1.4.3 compiler_3.6.1
[6] xts_0.12-0 tseries_0.10-47 tools_3.6.1 lattice_0.20-41 nlme_3.1-147
[11] lubridate_1.7.8 tsibble_0.8.6 lifecycle_0.2.0 fable_0.2.0 tibble_3.0.1
[16] gtable_0.3.0 anytime_0.3.7 pkgconfig_2.0.3 rlang_0.4.5 cli_2.0.2
[21] rstudioapi_0.11 parallel_3.6.1 curl_4.3 fma_2.4 generics_0.0.2
[26] vctrs_0.2.4 feasts_0.1.2 hms_0.5.3 nnet_7.3-13 lmtest_0.9-37
[31] forecast_8.12 grid_3.6.1 tidyselect_1.0.0 glue_1.4.0 R6_2.4.1
[36] expsmooth_2.3 fansi_0.4.1 TTR_0.23-6 fpp2_2.3 ggplot2_3.3.0
[41] purrr_0.3.4 tidyr_1.0.2 readr_1.3.1 magrittr_1.5 fpp3_0.2
[46] scales_1.1.0 ellipsis_0.3.0 fabletools_0.1.3 quantmod_0.4-15 assertthat_0.2.1 [51] timeDate_3043.102 colorspace_1.4-1 fracdiff_1.5-1 quadprog_1.5-8 utf8_1.1.4
[56] munsell_0.5.0 crayon_1.3.4 zoo_1.8-7

mitchelloharawild commented 4 years ago

Thanks for the bug report, I've removed the check as the interface change that it was re-directing is old enough now.