From the course: Data Visualization in R with ggplot2
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Working with maps
- [Instructor] We can use the ggmap library to pull up some basic maps in R. We'll use three functions to do this. The qmap function is short for quick map. You can pass qmap the name of a location and it will retrieve a map of that area from Google Maps or another source and plot it on the screen. You can also send other arguments that adjust the parameters of the map. We'll work with those in a moment. The get_map function takes the same arguments as qmap, but it only retrieves the map data and does not plot it. And the ggmap function plots a map that you retrieved with get_map. Let's try pulling up a map of New York City. I've already loaded the tidyverse and ggmap libraries and gone ahead and registered my API key. I'm now going to use the qmap function and pass out the argument New York, NY. I'm also going to pass it a zoom level. I'm going to set the zoom level to 10 which is the standard zoom for showing a city that is a large metropolitan area. When I go ahead and run this…
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
-
-
-
-
-
-
Visualizing data with maps2m 38s
-
(Locked)
Obtaining a Google Maps API key6m 58s
-
(Locked)
Working with maps3m 27s
-
(Locked)
Geocoding points4m 37s
-
(Locked)
Changing map types4m 18s
-
(Locked)
Plotting points on a map6m 42s
-
(Locked)
Building a map manually5m 37s
-
(Locked)
Creating a choropleth map9m 16s
-
-
-