all_trips_v2 %>%
mutate(weekday =wday(started_at, label=TRUE)) %>%
group_by(member_casual, month) %>%
summarise(number_of_rides = n(), average_duration = mean(ride_length)) %>%
arrange(member_casual, month)) %>%
ggplot(aes(x= member_casual, y= number_of_rides, fill= rideable_type)) + geom_col(position= “dodge”)
your code relies upon the presence of rideable_type as a field within the data.frame passed into ggplot() but the presence of the error message implies that this is not the case.
My assumption is that when you summarise() you result in a summarised data.frame with only the grouping variables (member_casual,month) and the two variables you define (number_of_rides, average_duration), and rideable_type is not among this set of 4 variables
Thank you so much. I got it fixed.
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.