เริ่มต้นใช้งานเริ่มต้นใช้งานได้ฟรี

Effect of membership and weekday

Expanding on the previous plot, let's add one more variable into our summary, adding a facet dimension for whether or not the rider is a member of BIXI.

แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร

Visualizing Big Data with Trelliscope in R

ดูคอร์ส

คำแนะนำการฝึกหัด

  • Compute the number of rides, n for each combination of start week, start hour of day, weekday, and membership.
  • Use points to plot n on the y-axis and start_wk on the x-axis and color the points by weekday.
  • Facet using facet_grid() to vary start_hod across columns and membership across rows.

แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ

ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์

library(dplyr)
library(ggplot2)

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

# Plot the result
ggplot(wk_memb_hod, aes(___, ___, color = ___)) +
  ___ +
  facet_grid(___ ~ ___) +
  scale_y_sqrt()
แก้ไขและรันโค้ด