Get startedGet started for free

Orienting with the data

Let's take our first look at the new speeding dataset.

First, print the data frame to your screen and try and get a sense of it. You can use filter()s, group_by()s or any of your tidyverse functions to do this.

The supplied code is what we used to make the histogram of blue car speeds in the slides. Modify this code to look at how many miles-per-hour red cars were going over the speed limit (speed_over). Give the plot a title while you're at it to let people know what they're looking at.

This exercise is part of the course

Visualization Best Practices in R

View Course

Exercise instructions

  • Print the md_speeding data frame to the console and investigate it.
  • Change filter() to 'RED' cars.
  • Change column of interest to speed_over.
  • Title plot 'MPH over speed limit | Red cars'

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Print data to console
___

# Change filter to red cars
md_speeding %>% 
	filter(vehicle_color == 'BLUE') %>% 
	# switch x mapping to speed_over column
	ggplot(aes(x = speed)) +
	geom_histogram() +
	# give plot a title
	
Edit and Run Code