Difference between revisions of "Mapping on R"

From edegan.com
Jump to navigation Jump to search
imported>Rachel
(New page: Quick Guide *Make sure you have downloaded the RgoogleMaps package. ** code: library(Rgooglemaps) * Create a base map **find geocode for center of desired map, adjust zoom as needed **ex...)
(No difference)

Revision as of 18:13, 2 December 2015

Quick Guide

  • Make sure you have downloaded the RgoogleMaps package.
    • code: library(Rgooglemaps)
  • Create a base map
    • find geocode for center of desired map, adjust zoom as needed
    • example code (for map of North America): newmap <- GetMap(center = c(39, -95), zoom = 3, destfile = "NorthAmerica.png")
  • Transform addresses into geocode via http://www.geocodezip.com/v3_example_geo2.asp?addr1=United%20States%20of%20America&geocode=1
  • Plot map, adjust variables
    • example code: PlotOnStaticMap(newmap, lat = c(30.268606, 41.888519), lon = c(-97.740467, -87.63548), pch = 20, col = "red")
    • lat=latitude; lon=longitude, pch = point style, color="color"