Error related to a package in Rstudio

Hey there!
I am a new user of Rstudio, and in order to complete my assignment, I installed few packages like fma, forecast and ggplot2 on Rstudio. But, I cannot access to few datasets available in the package and the command says invalid, while other users can access it.
Please, help me out with the problem as my assignment is due soon.
Thank you so much.!

Hi, welcome!

We don't really have enough info to help you out. Could you ask this with a minimal REPRoducible EXample (reprex)? A reprex makes it much easier for others to understand your issue and figure out how to help.

If you've never heard of a reprex before, you might want to start by reading this FAQ:

which package has the error, and can you paste exactly what the error says?

Hey Erica!
Thank you for replying to my query.

I tried working on library(fma) and wanted to retrieve data(pigs) through it.
The code is as follow:


And the result was,

Warning message:
In data(pigs) : data set ‘pigs’ not found

I don't seem to understand what is the problem because, data set - pigs is available under fma package but is not found when I run it. Please help me out.

Thank you so much
Have a good day!

Thanks for sharing your code, Arshpreet.

You can get immediate access by following the examples in

typical examples include






which all work, but are a bit disconcerting, as the dataset does not appear in your Environment tab, and you can not easily inspect this 188 value time series object of monthly data from 1980 to 1996.

You can (sort of) fix this by running

pigs_ts <- print(pigs)

which creates a new object, pigs_ts, in your environment which you can View()

1 Like

For what it is worth, I think Rob Hyndman, the creator of {fma} would probably use the {tsibble} package today, which creates tidy time series, and makes it easier to View() and inspect your data.

for example,

data("pedestrian") #shows up as a Promise in your Environment tab (not loading yet, lazy)
head(pedestrian) #opens up data, now truly available in your Environment (now actually has to load)

Dear Phiggins,
Greetings for the day!
I hope you are doing well.

You solution fixed my problem.
Thank you so much.

Warm regards.

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