visualizing data. error

Hi everyone.
Help me to find my mistake, please. Can't visualise the data.

bike_rides %>% 
  group_by(day_of_week, member_casual) %>% 
  summarise(number_of_rides = n(), avg_duration=mean(ride_length)) %>% 
  arrange(member_casual, day_of_week)
ggplot()+geom_col(mapping = aes(x=day_of_week, y=number_of_rides, fill=member_casual))+
  labs(title = "Number of rides by day", x= "Week Day", y= "Number of Rides")+
  theme(axis.text.x = element_text(angle = 45))

you have a naked call to ggplot() with no data= being set.
my guess is that you intended to pipe the above manipulations of bike_rides into it.

My advice would be to only do such a pipe for the most trivial of charts, or when there are no issues for you to debug or alter ; if you have any difficulty at all with achieving a desired plot, its far better to make a new data.frame with its own name (bike_rides_to_plot) and explicitly pass that to ggplot.

1 Like

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.