How do I solve the "objects of type tbl_df/tbl data.frame..." problem?

So I had my dataset imported from Excel which consists of 372 data points, and when I try to autoplot the dataset, it kept saying "Objects of type tbl_df/tbl/data.frame not supported by autoplot." I tried running the feasts package but it still remain the problem. How can I solve it?

I don't think you want to use autoplot(). Try using ggplot() instead. If you provide a small data set and describe what you want to do, someone can probably help you. An easy way to provide data is to use the dput() function. If your data are in a tibble named DF, you can get output representing the first 20 rows with


Paste the output of that into a reply on this thread. You can adjust the number 20 to whatever makes sense with your data.

If you are using the feasts package I assume that this is time series data. Did you convert the data to the tsibble format?

Yes I have, but I've tried autoplot and ggplot, but neither work

The first code results in an error because the data is still in tibble format. The next one will import an xlsx file (columns for the first day of each month and sales) as a tibble, convert the Excel date format to tsibble's yearmonth format, and then convert the tibble to the tsibble format required by the autoplot.tbl_ts function in the fabletools package. I do not know how to do a reprex that imports a local Excel file.

library(fpp3) # loads fable, feasts, tsibble packages and dplyr, tidyr, etc.

read_xlsx("data/lumber.xlsx") |>          # a tibble, month as <dttm>
  mutate(month = yearmonth(month)) |>     # still a tibble, month as <mth>
  autoplot(sales)                         # your error message

read_xlsx("data/lumber.xlsx") |>         # a tibble
  mutate(month = yearmonth(month)) |>    # still a tibble
  as_tsibble(index = month) |>           # now a tsibble
  autoplot(sales)                        # no error

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.