tidyverts / fabletools

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

Loading forecast after fabletools causes issues #375

Closed robjhyndman closed 1 year ago

robjhyndman commented 1 year ago
library(fpp3)
#> ── Attaching packages ─────────────────────────────────────── fpp3 0.4.0.9000 ──
#> ✔ tibble      3.1.8          ✔ tsibble     1.1.3     
#> ✔ dplyr       1.0.10         ✔ tsibbledata 0.4.1.9000
#> ✔ tidyr       1.2.1          ✔ feasts      0.3.0.9000
#> ✔ lubridate   1.9.0          ✔ fable       0.3.2.9000
#> ✔ ggplot2     3.4.0          ✔ fabletools  0.3.2.9000
#> ── Conflicts ───────────────────────────────────────────────── fpp3_conflicts ──
#> ✖ lubridate::date()    masks base::date()
#> ✖ dplyr::filter()      masks stats::filter()
#> ✖ tsibble::intersect() masks base::intersect()
#> ✖ tsibble::interval()  masks lubridate::interval()
#> ✖ dplyr::lag()         masks stats::lag()
#> ✖ tsibble::setdiff()   masks base::setdiff()
#> ✖ tsibble::union()     masks base::union()
library(forecast)
#> Registered S3 method overwritten by 'quantmod':
#>   method            from
#>   as.zoo.data.frame zoo
#> 
#> Attaching package: 'forecast'
#> The following objects are masked from 'package:fabletools':
#> 
#>     accuracy, forecast

us_change |> 
  model(MEAN(Consumption)) |> 
  forecast()
#> Warning in mean.default(x, na.rm = TRUE): argument is not numeric or logical:
#> returning NA
#>    Point Forecast Lo 80 Hi 80 Lo 95 Hi 95
#> 1              NA    NA    NA    NA    NA
#> 2              NA    NA    NA    NA    NA
#> 3              NA    NA    NA    NA    NA
#> 4              NA    NA    NA    NA    NA
#> 5              NA    NA    NA    NA    NA
#> 6              NA    NA    NA    NA    NA
#> 7              NA    NA    NA    NA    NA
#> 8              NA    NA    NA    NA    NA
#> 9              NA    NA    NA    NA    NA
#> 10             NA    NA    NA    NA    NA

Created on 2023-01-09 with reprex v2.0.2

library(fpp3)
#> ── Attaching packages ─────────────────────────────────────── fpp3 0.4.0.9000 ──
#> ✔ tibble      3.1.8          ✔ tsibble     1.1.3     
#> ✔ dplyr       1.0.10         ✔ tsibbledata 0.4.1.9000
#> ✔ tidyr       1.2.1          ✔ feasts      0.3.0.9000
#> ✔ lubridate   1.9.0          ✔ fable       0.3.2.9000
#> ✔ ggplot2     3.4.0          ✔ fabletools  0.3.2.9000
#> ── Conflicts ───────────────────────────────────────────────── fpp3_conflicts ──
#> ✖ lubridate::date()    masks base::date()
#> ✖ dplyr::filter()      masks stats::filter()
#> ✖ tsibble::intersect() masks base::intersect()
#> ✖ tsibble::interval()  masks lubridate::interval()
#> ✖ dplyr::lag()         masks stats::lag()
#> ✖ tsibble::setdiff()   masks base::setdiff()
#> ✖ tsibble::union()     masks base::union()

us_change |> 
  model(MEAN(Consumption)) |> 
  forecast()
#> # A fable: 8 x 4 [1Q]
#> # Key:     .model [1]
#>   .model            Quarter   Consumption .mean
#>   <chr>               <qtr>        <dist> <dbl>
#> 1 MEAN(Consumption) 2019 Q3 N(0.74, 0.41) 0.742
#> 2 MEAN(Consumption) 2019 Q4 N(0.74, 0.41) 0.742
#> 3 MEAN(Consumption) 2020 Q1 N(0.74, 0.41) 0.742
#> 4 MEAN(Consumption) 2020 Q2 N(0.74, 0.41) 0.742
#> 5 MEAN(Consumption) 2020 Q3 N(0.74, 0.41) 0.742
#> 6 MEAN(Consumption) 2020 Q4 N(0.74, 0.41) 0.742
#> 7 MEAN(Consumption) 2021 Q1 N(0.74, 0.41) 0.742
#> 8 MEAN(Consumption) 2021 Q2 N(0.74, 0.41) 0.742

Created on 2023-01-09 with reprex v2.0.2