每日圖表
現在來查看每一天的搭乘次數與小時的關係。首先,我們會為資料集中第一個完整月份(5 月)建立摘要資料集並加以檢視。
本練習屬於課程
使用 R 的 Trelliscope 視覺化巨量資料
練習說明
- 將資料篩選為 5 月(使用
start_mon) - 針對
start_day、start_hod與membership的每一種組合計算搭乘次數 - 使用散點繪製「搭乘次數 vs. 小時」,並依 membership 以顏色區分點
- 針對
start_day使用分面,套用facet_wrap(),並指定 7 欄以對齊星期
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
library(dplyr)
library(ggplot2)
# Compute daily_may
daily_may <- bike %>%
filter(___) %>%
group_by(___) %>%
summarise(n = ___)
# Plot the result
ggplot(daily_may, aes(___, ___, color = ___)) +
___ +
___