Help ~ why is this happening "$ operator is invalid for atomic vectors"

Hi Hi

I'm using the fpp2 package, which is already downloadable on R/R-Studio. I'm using R-Studio notebook.
All I'm trying to do is " "resshort" in the dataset "departures" and name it "mydata"..." which is assigned by my professor. I've done this before in a previous class.

Here's my code

mydata <- departures$resshort

but this message came up: "Error in departures$resshort : $ operator is invalid for atomic vectors"


The message means departures doesn't have list-like properties. This means departures may not be what you think it is.

So first see what departures is by looking at class(departures) (also typeof(), summary(), and str() are good tries).

Then you can research why departures is what it is (look into how you brought it in).


This topic was automatically closed 7 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.