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

Working with maps

From the course: Data Visualization in R with ggplot2

Start my 1-month free trial

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…

Contents