Problem with gg_season and gg_subseries

Hello, I have problems with my R.

I use package fpp3, but whenever I try to plot seasonal data using gg_season or gg_subseries, I always get this error message:
Error in exists(scale_fn, parent.frame(), mode = "function") :
first argument has length > 1

I tried using my own data and data from the textbook (Forecasting: Principles and Practice (3rd ed)), but I still got the error message.

Could you please help me find the cause of this problem?

Weclone to the frum.

I think we need a see your code and some sample data.

A handy way to supply some sample data is the dput() function. In the case of a large dataset something like dput(head(mydata, 100)) should supply the data we need. Just do dput(mydata) where mydata is your data. Copy the output and paste it here.

This is the code where I can't get the output. It is from the textbook.

library(fpp3)
a10 <- PBS %>%
filter(ATC2 == "A10") %>%
select(Month, Concession, Type, Cost) %>%
summarise(TotalC = sum(Cost)) %>%
mutate(Cost = TotalC / 1e6)
a10 %>%
gg_season(Cost, labels = "both") +
labs(y = " (millions)", title = "Seasonal plot: Antidiabetic drug sales") a10 %>% gg_subseries(Cost) + labs( y = " (millions)",
title = "Australian antidiabetic drug sales"
)

Please make a reprex and supply sample data. Please include any error messages.

Your code at the moment is essentially unreadable and there is no sample data.

PBS is a data set in the tsibbledata package, which is loaded by library(fpp3)

Everything works fine for me up to labs(y = ". There are problems in the next line.


library(fpp3)

a10 <- PBS %>%
  filter(ATC2 == "A10") %>%
  select(Month, Concession, Type, Cost) %>%
  summarise(TotalC = sum(Cost)) %>%
  mutate(Cost = TotalC / 1e6)

a10 %>% gg_season(Cost, labels = "both") +
  labs(y = "(millions)", title = "Seasonal plot: Antidiabetic drug sales")


a10 %>% gg_subseries(Cost) + 
  labs(y = "(millions)", title = "Australian antidiabetic drug sales")

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

Yes, this is what I should get but my R always give this error message:

Error in exists(scale_fn, parent.frame(), mode = "function") :
first argument has length > 1

I tried to run the code using other laptop and it works fine. My friends also can run it in their laptop. Is this problem happened because of my laptop? Is there any ways to fix it?

I do not know enough to figure out the cause of the problem based on the error message.

Do you have the same version of R that is on the other computers? If yours is older you should probably update.

Have you tried reinstalling the {feasts} package?

Those two functions probably use {ggplot2}, so try reinstalling that package as well.

Sorry that I cannot be of more help. Good luck!

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.