From the course: Data Visualization in R with ggplot2
Unlock this course with a free trial
Join today to access over 25,300 courses taught by industry experts.
Creating a choropleth map
From the course: Data Visualization in R with ggplot2
Creating a choropleth map
- [Instructor] Choropleth maps are a powerful visualization tool that allows us to see regional differences in data. In an earlier video, I showed you how the CDC uses choropleth maps to track outbreaks of influenza. Now that you've learned how to build maps using polygons, you're ready to create your own choropleth maps. Let's give it a try in R. I already have the code here to load the college dataset that we've been working with throughout the course, and I've run it, and I've also loaded the state map dataset. Now, I'd like to color code states based upon how many schools are in each state. Before I can plot a choropleth map, I need to get my data in order. First, I need to figure out how many schools are in each state. I can use some functions from the dplyr library to help me with that. I'm going to create a new dataset called college_summary, and I'm going to populate that by taking in the college dataset and piping it to the group_by function. I'm going to group this by state…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
(Locked)
Visualizing data with maps2m 14s
-
(Locked)
Obtaining a Google Maps API key5m 19s
-
(Locked)
Working with map data2m 32s
-
(Locked)
Geocoding points3m 26s
-
(Locked)
Changing map types1m 19s
-
(Locked)
Plotting points on a map5m 6s
-
(Locked)
Building a map manually4m 21s
-
(Locked)
Creating a choropleth map6m 53s
-
(Locked)
-
-