0

I wrote below code using R in Kaggle, but output error, I install packages tidy verse and library ggplot2 again, still shew error. I hope to find out a solution here, thanks!

rides_hour %>%
  ggplot(data = rides_hour)+
    geom_bar(mapping = aes(x = time, y = ride_count, fill = member_casual))


Error in ggplot(., data = rides_hour): object 'rides_hour' not found
Traceback:

1. rides_hour %>% ggplot(data = rides_hour)
2. ggplot(., data = rides_hour)
Jingke66
  • 1
  • 1

1 Answers1

0

rides_hour must be a data.frame. If you are using data = rides_hour you do not need to use rides_hour %>% ggplot....

Instead, use ggplot(data = rides_hour) + geom_bar(mapping = aes(x = time, y = ride_count, fill = member_casual)).

The ideal would be to share with us the data you are using. ;)

  • Hi Marcio, I remvoed "rides_hour %>%", but still same error. For you mentioned "rides_hour must be a data.from", I checked rides_hour is from a combine csv file. If is there a step to transfer in Kaggle? I learned R a month, in RStudio, upload the csv file to R, looks no step to transfer. – Jingke66 Dec 19 '22 at 15:34
  • Hi @Jingke66! See about how to make a reproducible example in R [here](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). There are some tips you can use to share your data and code with us to have a satisfactory feedback. – Marcio Cure Dec 19 '22 at 16:35