O'Reilly logo

R Data Analysis Cookbook - Second Edition by Kuntal Ganguly

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How it works...

First, the RgoogleMaps package is loaded and the data file is read. The file has geographic and other data for several school districts in New Jersey. We aim to show a Google map of the general area and overlay the average wages for each school district on the map.

Next, the cut function is used on the Avgwg column to create a new column called wgclass. This column represents the quantile to which a school district belongs. Then we create a color palette with five colors--one for each quantile. Next, the MapBackground function is used to get the static Google map for the general area and  pass all the latitudes and longitudes to determine the overall extent of the map.

Finally, the PlotOnStaticMap function is used to plot ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required