Why do I keep getting an error for the $ operator being invalid for atomic vectors?

I am creating a Kaggle notebook for my first analysis and I am having issues with my scripts

I wrote out this script to filter out any numbers less than zero from my data set.

nrow(trips_2019[trips_2019$ride_length < 0,])
trips_2019 <- trips_2019[!trips_2019$ride_length <0,]

I copy and pasted this script directly from R-Studio into Kaggle and I keep getting this error regarding the $
operator being invalid for atomic vectors.
I tried copying and pasting it again multiple times from R-Studio and also tried typing it manually as
well to make sure there were no typos. Not really sure how else to go out solving this.
Please let me know if someone has advice on this.


Where does this come from. I would expect to the see error you quoted if while in rstudio trips_2019 is some data.frame and on your kaggle at the point where you apply this code trips_2019 is not a data.frame
Perhaps investigate that....
Where does trip_2019 arise from ? and did you introduce steps in your kaggle notebook to alter it that you didnt in your R script ?

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