1

I am following Rob Hyndman forecasting book and I can not use autoplot even in this simple example, extracted from the book:

library(ggplot2)
library(tsibble)
y <- tsibble(Year = 2015:2019,
             Observation = c(123,39,78,52,110),
             index = Year)
autoplot(y)

I got the following error: Error: Objects of type tbl_ts/tbl_df/tbl/data.frame not supported by autoplot. I have for sure that y is a tsibble:

y
# A tsibble: 5 x 2 [1Y]
   Year Observation
  <int>       <dbl>
1  2015         123
2  2016          39
3  2017          78
4  2018          52
5  2019         110
Steffen Moritz
  • 7,277
  • 11
  • 36
  • 55
sbac
  • 1,897
  • 1
  • 18
  • 31
  • 2
    Try fablelite::autoplot(y) ggplot does not support tsibble objects by default. Loading fable or fablelite will effectively update how ggplot works to allow it to work with tsibble – JFlynn Oct 02 '19 at 12:41
  • 1
    I loaded `fable` and it works now.Couldn't find `fablelite`on CRAN. – sbac Oct 02 '19 at 13:46
  • 3
    fablelite is now called fabletools. Loading fable will automatically load fabletools. – Rob Hyndman Oct 02 '19 at 22:10

0 Answers0