课程: Data Visualization in R with ggplot2

免费学习该课程!

今天就开通帐号,24,700 门业界名师课程任您挑!

Creating a choropleth map

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…

内容