Examining time-of-day
Now let's look at how rides are distributed according to the time of day. Let's make a summary plot of weekly ride counts faceted by start hour of day and broken down by workweek/weekend.
Cet exercice fait partie du cours
Visualizing Big Data with Trelliscope in R
Instructions
- Compute the number of rides,
n, for each combination of start week (start_wk), start hour of day (start_hod), andweekday. - Use points to plot
non the y-axis andstart_wkon the x-axis and color the points byweekday. - Facet on
start_hodsuch that there is one row of panels and 24 columns, one for each hour of day, usingfacet_grid().
Exercice interactif pratique
Essayez cet exercice en complétant cet exemple de code.
library(dplyr)
library(ggplot2)
# Compute week_hod
week_hod <- bike %>%
___ %>%
___
# Plot the result
ggplot(week_hod, aes(___, ___, color = ___)) +
___ +
facet_grid(~ ___) +
scale_y_sqrt()