First, we will visualize the total number of bicycle rentals per station by means of a bar chart. For this, we need to make a small transformation to the data with the dplyr package and then we will use the ggplot2 package to generate the plot:
- Create a data frame to summarize and transform the station, workingday, and cnt variables with dplyr:
> bike.sum =bike %>% group_by(season, workingday) %>% summarize(rental = sum(cnt))
- Plot the bar graph for each station:
> ggplot(bike.sum, aes(x= season, y= rental)) + geom_bar(show.legend = TRUE, stat = "identity") + labs(title = "Rentals for Season and Day")
The following diagram is the ggplot:
- Now plot a bar graph by each station segmented by the workingday ...