開始使用免費開始

會員身份與星期幾的影響

延伸上一個圖表,再把一個變數加進摘要——為騎乘者是否為 BIXI 會員加入分面維度。

本練習屬於課程

使用 R 的 Trelliscope 視覺化巨量資料

檢視課程

練習說明

  • 計算每個起始週、一天中的起始小時、星期幾與會員身分組合的騎乘次數 n
  • 使用散點將 n 畫在 y 軸、start_wk 畫在 x 軸,並以 weekday 上色點的顏色。
  • 使用 facet_grid() 分面:欄位跨 start_hod、列跨 membership

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

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()
編輯並執行程式碼