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

Relationship between trip duration and total fare

We would assume that there is a relationship between the total cab fare and the duration of the trip. Since there are too many data points to make a scatterplot, let's use a hexagon-binned plot to investigate this relationship.

tx is available for you in your workspace.

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

Visualizing Big Data with Trelliscope in R

ดูคอร์ส

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

  • Use hexagon bins to visualize the bivariate distribution of total_amount (y-axis) vs. trip_duration (x-axis).
  • Set the bins argument of geom_hex() to 75.
  • Since both variables are highly skewed, rescale both the x and y axes to log base 10. Note that these transformations will generate some warnings about a relatively small number of records with zero trip duration or fare amount.

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

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

library(ggplot2)

# Create a hexagon-binned plot of total_amount vs. trip_duration
ggplot(tx, aes(___, ___)) +
  ___ +
  ___ +
  ___
แก้ไขและรันโค้ด