Getting to Work With Confidence: Visualize the Data
Donny doesn't like to wake up early, so he often arrives late to work. Donny blames his lateness on traffic. While Donny usually leaves home 10 minutes before work, and his commute takes 10 minutes on average, his commute often takes longer than 10 minutes. For a year, Donny, measures exactly how many minutes his morning commute takes, and records it in the vector Commute
. Let's use this information to help Donny figure out when he should leave for work if he wants to arrive to work on time.
This exercise is part of the course
Causal Inference with R - Experiments
Exercise instructions
- 1) Summarize the data in table form to see what information we have about Donny's commute.
- 2) Visualize the data with a density plot to get a better sense for the distribution of his commute times.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# 1) Let's first summarize Donny's commute time to get a sense of what the data looks like. Use the summary function on the dataframe Commute.
summary()
# 2) It seems that Donny's travel time is usually less than 10 minutes, but it can last as long as 23 minutes! For additional information, let's also plot what Donny's commute time looks like on a density curve. This is just another way of representing Donny's commute time. Use the plot(density()) commands on the dataframe Commute.
plot(density())