Error [1] `.x` is empty, and no `.init` supplied when using %S% operator
pherreraariza opened this issue · 14 comments
I'm getting a weird error while trying to fit a FASSTER model when using the %S% operator. Not happening when I simpley replace the %S% for '+'.
Just reinstalled the fasster, fabletools packages a while ago not solved the problem. I have no idea what might be happen. Any help will be appreciate.
library(tsibble)
library(tsibbledata)
library(fasster)
data(vic_elec)
elec_fit <- vic_elec %>%
model(FASSTER(
log(Demand) ~
Holiday %S% (trig(48, 16) + poly(1)) +
Temperature + I(Temperature^2)
))
Warning message:
1 error encountered for FASSTER(log(Demand) ~ Holiday %S% (trig(48, 16) + poly(1)) +
Temperature + I(Temperature^2))
[1] `.x` is empty, and no `.init` supplied
Session info:
R version 3.6.1 (2019-07-05)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Catalina 10.15.3
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib
locale:
[1] es_ES.UTF-8/es_ES.UTF-8/es_ES.UTF-8/C/es_ES.UTF-8/es_ES.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] tsibbledata_0.1.0 fasster_0.1.0.9100 fabletools_0.1.3 mgcv_1.8-28
[5] nlme_3.1-141 readxl_1.3.1 rapportools_1.0 reshape_0.8.8
[9] tsibble_0.8.6 ggTimeSeries_1.0.1 PerformanceAnalytics_1.5.3 tidyr_0.8.3
[13] GGally_1.4.0 recipes_0.1.9 dplyr_0.8.3 caretEnsemble_2.0.1
[17] rattle_5.2.0 corrplot_0.84 caret_6.0-84 lattice_0.20-38
[21] psych_1.8.12 reshape2_1.4.3 data.table_1.12.2 ggplot2_3.2.1
[25] jsonlite_1.6 lubridate_1.7.4 RCurl_1.95-4.12 bitops_1.0-6
[29] Quandl_2.10.0 xts_0.11-2 zoo_1.8-6
loaded via a namespace (and not attached):
[1] httr_1.4.1 splines_3.6.1 foreach_1.4.7 prodlim_2018.04.18 assertthat_0.2.1 stats4_3.6.1
[7] pander_0.6.3 cellranger_1.1.0 ipred_0.9-9 pillar_1.4.2 glue_1.3.1 quadprog_1.5-7
[13] digest_0.6.22 RColorBrewer_1.1-2 colorspace_1.4-1 Matrix_1.2-17 plyr_1.8.4 timeDate_3043.102
[19] pkgconfig_2.0.2 purrr_0.3.2 scales_1.1.0 gower_0.2.1 lava_1.6.6 tibble_2.1.3
[25] farver_2.0.1 generics_0.0.2 withr_2.1.2 pbapply_1.4-1 nnet_7.3-12 lazyeval_0.2.2
[31] cli_1.1.0 mnormt_1.5-5 survival_3.1-7 magrittr_1.5 crayon_1.3.4 fansi_0.4.0
[37] MASS_7.3-51.4 anytime_0.3.5 foreign_0.8-72 class_7.3-15 tools_3.6.1 lifecycle_0.1.0
[43] stringr_1.4.0 munsell_0.5.0 dlm_1.1-5 compiler_3.6.1 rlang_0.4.5 grid_3.6.1
[49] iterators_1.0.12 rstudioapi_0.10 labeling_0.3 gtable_0.3.0 ModelMetrics_1.2.2 codetools_0.2-16
[55] curl_4.0 R6_2.4.0 gridExtra_2.3 knitr_1.24 utf8_1.1.4 stringi_1.4.3
[61] parallel_3.6.1 Rcpp_1.0.3 vctrs_0.2.4 rpart_4.1-15 tidyselect_0.2.5 xfun_0.8
I have the same issue. This error seems to be raised in purrr reduce.
I had this problem with my data. When I tried this example I had the same error message.
I have the same issue. This error seems to be raised in purrr reduce.
Have you tried to install an older version of purrr?
Have you tried to install an older version of purrr?
This verification and error message were introduced in purrr 0.2.3 so a while ago now.
I tried every version of purrr from 0.2.3 to 0.3.4 included and always get the same message, but I might have done something wrong and not properly tested these versions.
I suspect the issue comes from fasster or fabletools but I lack experience debugging R so I'm quite inefficient and mostly stuck for now. I hope @mitchelloharawild will come to our rescue :-)
I've been trying to reproduce this, but haven't been able to narrow it down yet. The error is presumably from purrr::reduce()
, and if it is only when using %S%
then my guess is that the issue is from here:
Lines 63 to 65 in 425543b
Could you try this simpler example?
library(fasster)
#> Loading required package: fabletools
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
as_tsibble(USAccDeaths) %>%
mutate(grp = rep(c("a", "b"), length.out = n())) %>%
model(FASSTER(value ~ grp %S% trig(12, 2) + poly(1))) %>%
report()
#> Series: value
#> Model: FASSTER
#>
#> Estimated variances:
#> State noise variances (W):
#> grp_a/trig(12, 2)
#> 2.3093e-13 1.0134e-13 7.3003e-14 4.0158e-14
#> grp_b/trig(12, 2)
#> 8.1743e-14 2.2243e-14 4.3274e-14 4.2210e-14
#> poly(1)
#> 5.7302e+03
#>
#> Observation noise variance (V):
#> 4.7197e+04
Created on 2020-04-22 by the reprex package (v0.3.0)
Session info
devtools::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#> setting value
#> version R version 3.6.2 (2019-12-12)
#> os Ubuntu 18.04.4 LTS
#> system x86_64, linux-gnu
#> ui X11
#> language en_AU:en
#> collate en_AU.UTF-8
#> ctype en_AU.UTF-8
#> tz Australia/Melbourne
#> date 2020-04-22
#>
#> ─ Packages ───────────────────────────────────────────────────────────────────
#> ! package * version date lib source
#> P anytime 0.3.7 2020-01-20 [?] CRAN (R 3.6.2)
#> assertthat 0.2.1 2019-03-21 [1] RSPM (R 3.6.2)
#> backports 1.1.6 2020-04-05 [1] RSPM (R 3.6.2)
#> callr 3.4.3 2020-03-28 [1] RSPM (R 3.6.2)
#> cli 2.0.2 2020-02-28 [1] RSPM (R 3.6.2)
#> colorspace 1.4-1 2019-03-18 [1] RSPM (R 3.6.2)
#> crayon 1.3.4 2017-09-16 [1] RSPM (R 3.6.2)
#> desc 1.2.0 2018-05-01 [1] RSPM (R 3.6.2)
#> P devtools 2.2.2 2020-02-17 [?] RSPM (R 3.6.2)
#> digest 0.6.25 2020-02-23 [1] RSPM (R 3.6.2)
#> dlm 1.1-5 2018-06-13 [1] RSPM (R 3.6.2)
#> P dplyr * 0.8.5 2020-03-07 [?] RSPM (R 3.6.2)
#> ellipsis 0.3.0 2019-09-20 [1] RSPM (R 3.6.2)
#> evaluate 0.14 2019-05-28 [1] RSPM (R 3.6.2)
#> P fabletools * 0.1.3 2020-03-24 [?] RSPM (R 3.6.2)
#> fansi 0.4.1 2020-01-08 [1] RSPM (R 3.6.2)
#> fasster * 0.1.0.9100 2020-04-22 [1] local
#> P fs 1.3.2 2020-03-05 [?] RSPM (R 3.6.2)
#> P generics 0.0.2 2018-11-29 [?] CRAN (R 3.6.2)
#> ggplot2 3.3.0 2020-03-05 [1] RSPM (R 3.6.2)
#> glue 1.4.0 2020-04-03 [1] RSPM (R 3.6.2)
#> gtable 0.3.0 2019-03-25 [1] RSPM (R 3.6.2)
#> P highr 0.8 2019-03-20 [?] CRAN (R 3.6.2)
#> P htmltools 0.4.0 2019-10-04 [?] CRAN (R 3.6.2)
#> P knitr 1.28 2020-02-06 [?] CRAN (R 3.6.2)
#> lifecycle 0.2.0 2020-03-06 [1] RSPM (R 3.6.2)
#> lubridate 1.7.8 2020-04-06 [1] RSPM (R 3.6.2)
#> magrittr 1.5 2014-11-22 [1] RSPM (R 3.6.2)
#> P memoise 1.1.0 2017-04-21 [?] RSPM (R 3.6.2)
#> munsell 0.5.0 2018-06-12 [1] RSPM (R 3.6.2)
#> pillar 1.4.3 2019-12-20 [1] RSPM (R 3.6.2)
#> pkgbuild 1.0.6 2019-10-09 [1] RSPM (R 3.6.2)
#> pkgconfig 2.0.3 2019-09-22 [1] RSPM (R 3.6.2)
#> pkgload 1.0.2 2018-10-29 [1] RSPM (R 3.6.2)
#> prettyunits 1.1.1 2020-01-24 [1] RSPM (R 3.6.2)
#> processx 3.4.2 2020-02-09 [1] RSPM (R 3.6.2)
#> ps 1.3.2 2020-02-13 [1] RSPM (R 3.6.2)
#> purrr 0.3.4 2020-04-17 [1] RSPM (R 3.6.2)
#> R6 2.4.1 2019-11-12 [1] RSPM (R 3.6.2)
#> Rcpp 1.0.4.6 2020-04-09 [1] CRAN (R 3.6.2)
#> P remotes 2.1.1 2020-02-15 [?] CRAN (R 3.6.2)
#> renv 0.9.2 2019-12-09 [1] RSPM (R 3.6.1)
#> rlang 0.4.5 2020-03-01 [1] RSPM (R 3.6.2)
#> P rmarkdown 2.1 2020-01-20 [?] CRAN (R 3.6.2)
#> rprojroot 1.3-2 2018-01-03 [1] RSPM (R 3.6.2)
#> scales 1.1.0 2019-11-18 [1] RSPM (R 3.6.2)
#> P sessioninfo 1.1.1 2018-11-05 [?] RSPM (R 3.6.2)
#> P stringi 1.4.6 2020-02-17 [?] CRAN (R 3.6.2)
#> P stringr 1.4.0 2019-02-10 [?] CRAN (R 3.6.2)
#> testthat 2.3.2 2020-03-02 [1] RSPM (R 3.6.2)
#> tibble 3.0.1 2020-04-20 [1] CRAN (R 3.6.2)
#> P tidyr 1.0.2 2020-01-24 [?] CRAN (R 3.6.2)
#> P tidyselect 1.0.0 2020-01-27 [?] CRAN (R 3.6.2)
#> P tsibble 0.8.6 2020-01-31 [?] CRAN (R 3.6.2)
#> P usethis 1.5.1 2019-07-04 [?] CRAN (R 3.6.2)
#> vctrs 0.2.4 2020-03-10 [1] RSPM (R 3.6.2)
#> withr 2.2.0 2020-04-20 [1] CRAN (R 3.6.2)
#> P xfun 0.12 2020-01-13 [?] CRAN (R 3.6.2)
#> P yaml 2.2.1 2020-02-01 [?] CRAN (R 3.6.2)
#>
#> [1] /home/mitchell/teaching/ETC3550/renv/library/R-3.6/x86_64-pc-linux-gnu
#> [2] /tmp/RtmpgJVZKL/renv-system-library
#> [3] /tmp/RtmpaxMT8q/renv-system-library
#>
#> P ── Loaded and on-disk path mismatch.
library(fasster)
#> Le chargement a nécessité le package : fabletools
library(dplyr)
#>
#> Attachement du package : 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
as_tsibble(USAccDeaths) %>%
mutate(grp = rep(c("a", "b"), length.out = n())) %>%
model(FASSTER(value ~ grp %S% trig(12, 2) + poly(1))) %>%
report()
#> Warning: 1 error encountered for FASSTER(value ~ grp %S% trig(12, 2) + poly(1))
#> [1] `.x` is empty, and no `.init` supplied
#> Series: value
#> Model: NULL model
#> NULL model
Created on 2020-04-22 by the reprex package (v0.3.0)
Session info
devtools::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#> setting value
#> version R version 3.6.3 (2020-02-29)
#> os Ubuntu 18.04.4 LTS
#> system x86_64, linux-gnu
#> ui X11
#> language (EN)
#> collate fr_FR.UTF-8
#> ctype fr_FR.UTF-8
#> tz Europe/Paris
#> date 2020-04-22
#>
#> ─ Packages ───────────────────────────────────────────────────────────────────
#> package * version date lib source
#> anytime 0.3.7 2020-01-20 [1] CRAN (R 3.6.2)
#> assertthat 0.2.1 2019-03-21 [1] CRAN (R 3.6.1)
#> backports 1.1.6 2020-04-05 [1] CRAN (R 3.6.3)
#> callr 3.4.3 2020-03-28 [1] CRAN (R 3.6.3)
#> cli 2.0.2 2020-02-28 [1] CRAN (R 3.6.3)
#> colorspace 1.4-1 2019-03-18 [1] CRAN (R 3.6.1)
#> crayon 1.3.4 2017-09-16 [1] CRAN (R 3.6.1)
#> desc 1.2.0 2018-05-01 [1] CRAN (R 3.6.1)
#> devtools 2.3.0 2020-04-10 [1] CRAN (R 3.6.3)
#> digest 0.6.25 2020-02-23 [1] CRAN (R 3.6.3)
#> dlm 1.1-5 2018-06-13 [1] CRAN (R 3.6.3)
#> dplyr * 0.8.5 2020-03-07 [1] CRAN (R 3.6.3)
#> ellipsis 0.3.0 2019-09-20 [1] CRAN (R 3.6.1)
#> evaluate 0.14 2019-05-28 [1] CRAN (R 3.6.1)
#> fabletools * 0.1.3 2020-03-24 [1] CRAN (R 3.6.3)
#> fansi 0.4.1 2020-01-08 [1] CRAN (R 3.6.3)
#> fasster * 0.1.0.9100 2020-04-22 [1] Github (tidyverts/fasster@425543b)
#> fs 1.4.1 2020-04-04 [1] CRAN (R 3.6.3)
#> generics 0.0.2 2018-11-29 [1] CRAN (R 3.6.1)
#> ggplot2 3.3.0 2020-03-05 [1] CRAN (R 3.6.3)
#> glue 1.4.0 2020-04-03 [1] CRAN (R 3.6.3)
#> gtable 0.3.0 2019-03-25 [1] CRAN (R 3.6.1)
#> highr 0.8 2019-03-20 [1] CRAN (R 3.6.0)
#> htmltools 0.4.0 2019-10-04 [1] CRAN (R 3.6.1)
#> knitr 1.28 2020-02-06 [1] CRAN (R 3.6.3)
#> lifecycle 0.2.0 2020-03-06 [1] CRAN (R 3.6.3)
#> lubridate 1.7.8 2020-04-06 [1] CRAN (R 3.6.3)
#> magrittr 1.5 2014-11-22 [1] CRAN (R 3.6.1)
#> memoise 1.1.0 2017-04-21 [1] CRAN (R 3.6.1)
#> munsell 0.5.0 2018-06-12 [1] CRAN (R 3.6.1)
#> pillar 1.4.3 2019-12-20 [1] CRAN (R 3.6.3)
#> pkgbuild 1.0.6 2019-10-09 [1] CRAN (R 3.6.3)
#> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 3.6.1)
#> pkgload 1.0.2 2018-10-29 [1] CRAN (R 3.6.1)
#> prettyunits 1.1.1 2020-01-24 [1] CRAN (R 3.6.3)
#> processx 3.4.2 2020-02-09 [1] CRAN (R 3.6.3)
#> ps 1.3.2 2020-02-13 [1] CRAN (R 3.6.3)
#> purrr 0.3.4 2020-04-17 [1] CRAN (R 3.6.3)
#> R6 2.4.1 2019-11-12 [1] CRAN (R 3.6.2)
#> Rcpp 1.0.4.6 2020-04-09 [1] CRAN (R 3.6.3)
#> remotes 2.1.1 2020-02-15 [1] CRAN (R 3.6.3)
#> rlang 0.4.5 2020-03-01 [1] CRAN (R 3.6.3)
#> rmarkdown 2.1 2020-01-20 [1] CRAN (R 3.6.3)
#> rprojroot 1.3-2 2018-01-03 [1] CRAN (R 3.6.1)
#> scales 1.1.0 2019-11-18 [1] CRAN (R 3.6.3)
#> sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 3.6.1)
#> stringi 1.4.6 2020-02-17 [1] CRAN (R 3.6.3)
#> stringr 1.4.0 2019-02-10 [1] CRAN (R 3.6.0)
#> testthat 2.3.2 2020-03-02 [1] CRAN (R 3.6.3)
#> tibble 3.0.1 2020-04-20 [1] CRAN (R 3.6.3)
#> tidyr 1.0.2 2020-01-24 [1] CRAN (R 3.6.3)
#> tidyselect 1.0.0 2020-01-27 [1] CRAN (R 3.6.3)
#> tsibble 0.8.6 2020-01-31 [1] CRAN (R 3.6.2)
#> usethis 1.6.0 2020-04-09 [1] CRAN (R 3.6.3)
#> vctrs 0.2.4 2020-03-10 [1] CRAN (R 3.6.3)
#> withr 2.2.0 2020-04-20 [1] CRAN (R 3.6.3)
#> xfun 0.13 2020-04-13 [1] CRAN (R 3.6.3)
#> yaml 2.2.1 2020-02-01 [1] CRAN (R 3.6.3)
#>
#> [1] /home/mathieu/R/x86_64-pc-linux-gnu-library/3.6
#> [2] /usr/local/lib/R/site-library
#> [3] /usr/lib/R/site-library
#> [4] /usr/lib/R/library
Could you post your sessionInfo()
?
Same error to me:
Series: value Model: NULL model NULL modelWarning message: 1 error encountered for FASSTER(value ~ grp %S% trig(12, 2) + poly(1)) [1]
.xis empty, and no
.init supplied
R version 3.6.1 (2019-07-05)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Catalina 10.15.3
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib
locale:
[1] es_ES.UTF-8/es_ES.UTF-8/es_ES.UTF-8/C/es_ES.UTF-8/es_ES.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] dplyr_0.8.5 fasster_0.1.0.9100 fabletools_0.1.3
loaded via a namespace (and not attached):
[1] Rcpp_1.0.4 rstudioapi_0.11 magrittr_1.5 munsell_0.5.0 tidyselect_1.0.0 colorspace_1.4-1
[7] anytime_0.3.7 R6_2.4.1 rlang_0.4.5 fansi_0.4.1 stringr_1.4.0 tools_3.6.1
[13] grid_3.6.1 gtable_0.3.0 cli_2.0.2 ellipsis_0.3.0 assertthat_0.2.1 tibble_3.0.0
[19] lifecycle_0.2.0 crayon_1.3.4 tidyr_1.0.2 purrr_0.3.3 ggplot2_3.3.0 vctrs_0.2.4
[25] glue_1.3.2 stringi_1.4.6 compiler_3.6.1 pillar_1.4.3 scales_1.1.0 generics_0.0.2
[31] dlm_1.1-5 tsibble_0.8.6 lubridate_1.7.4 pkgconfig_2.0.3
I apologize for the repeated editions of my comments, I am still learning to use reprex.
My first answer now includes the session_info.
I have a different version of R installed but the error is the same.
as_tsibble(USAccDeaths) %>%
mutate(grp = rep(c("a", "b"), length.out = n())) %>%
model(FASSTER(value ~ grp %S% trig(12, 2) + poly(1))) %>%
report()
Series: value
Model: NULL model
NULL modelWarning message:
1 error encountered for FASSTER(value ~ grp %S% trig(12, 2) + poly(1))
[1] `.x` is empty, and no `.init` supplied
sessionInfo()
R version 3.6.3 (2020-02-29)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17763)
Matrix products: default
locale:
[1] LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=English_United Kingdom.1252 LC_MONETARY=English_United Kingdom.1252
[4] LC_NUMERIC=C LC_TIME=English_United Kingdom.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] beepr_1.3 tictoc_1.0 fasster_0.1.0.9100 fable_0.1.2 feasts_0.1.3 fabletools_0.1.3
[7] tsibbledata_0.1.0 tsibble_0.8.6 ggplot2_3.3.0 lubridate_1.7.8 tidyr_1.0.2 dplyr_0.8.5
[13] tibble_3.0.0 fpp3_0.2
loaded via a namespace (and not attached):
[1] Rcpp_1.0.4.6 pillar_1.4.3 compiler_3.6.3 tools_3.6.3 lifecycle_0.2.0 gtable_0.3.0 anytime_0.3.7
[8] pkgconfig_2.0.3 rlang_0.4.5 cli_2.0.2 rstudioapi_0.11 stringr_1.4.0 withr_2.1.2 generics_0.0.2
[15] vctrs_0.2.4 grid_3.6.3 tidyselect_1.0.0 glue_1.4.0 R6_2.4.1 fansi_0.4.1 dlm_1.1-5
[22] purrr_0.3.3 magrittr_1.5 scales_1.1.0 ellipsis_0.3.0 assertthat_0.2.1 colorspace_1.4-1 utf8_1.1.4
[29] stringi_1.4.6 munsell_0.5.0 crayon_1.3.4 audio_0.1-7
I have been able to reproduce this on a fresh installation. I think the bigger mystery is why it is working on my system. 🤷
Should work fine now, sorry for the long wait!
It does work for me.
Thanks a lot @mitchelloharawild !
Your fix came just in time for my current use case :-)