ComeçarComece de graça

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.

Este exercício faz parte do curso

Visualizing Big Data with Trelliscope in R

Ver curso

Instruções do exercício

  • Compute the number of rides, n, for each combination of start week (start_wk), start hour of day (start_hod), and weekday.
  • Use points to plot n on the y-axis and start_wk on the x-axis and color the points by weekday.
  • Facet on start_hod such that there is one row of panels and 24 columns, one for each hour of day, using facet_grid().

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

library(dplyr)
library(ggplot2)

# Compute week_hod
week_hod <- bike %>%
  ___ %>%
  ___

# Plot the result
ggplot(week_hod, aes(___, ___, color = ___)) +
  ___ +
  facet_grid(~ ___) +
  scale_y_sqrt()
Editar e executar o código