MulaiMulai sekarang secara gratis

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.

Latihan ini adalah bagian dari kursus

Visualization Best Practices in R

Lihat Kursus

Petunjuk latihan

  • 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'

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# 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 dan Jalankan Kode