LoslegenKostenlos loslegen

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.

Diese Übung ist Teil des Kurses

Visualizing Big Data with Trelliscope in R

Kurs anzeigen

Anleitung zur Übung

  • 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().

Interaktive Übung

Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.

library(dplyr)
library(ggplot2)

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

# Plot the result
ggplot(week_hod, aes(___, ___, color = ___)) +
  ___ +
  facet_grid(~ ___) +
  scale_y_sqrt()
Code bearbeiten und ausführen