Daily ride counts
A useful way to tabulate and visualize cab rides is by looking at the number of rides according to the calendar day. In this exercise, you'll compute this summary and examine how daily ridership varies by time and the day of week.
The tx data set is preloaded for you.
Questo esercizio fa parte del corso
Visualizing Big Data with Trelliscope in R
Istruzioni dell'esercizio
- Create a daily summary, grouping by the date of pickup (
pickup_date) and counting the number of rides, calling the new variablen_rides. Recall that dplyr'sn()function provides a count of how many observations are in each group. - Plot the result using ggplot2's
geom_line(), withpickup_dateon the x-axis andn_rideson the y-axis.
Esercizio pratico interattivo
Prova a risolvere questo esercizio completando il codice di esempio.
library(dplyr)
library(ggplot2)
# Summarize the number of taxi rides by pickup day
daily_count <- tx %>%
group_by(___) %>%
summarise(n_rides = ___)
# Create a line plot
ggplot(daily_count, aes(___, ___)) +
___