*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"
Example Code===Mapping with Leaflet=== [[Image:leaflet.png|200px|thumb|right|Interactive map on Leaflet]][[Image:marker.png|200px|thumb|right|Interactive map with Markers]] Leaflet is one of the most popular open-source JavaScript libraries for interactive maps. This R package makes it easy to integrate and control Leaflet maps in R.Chicago MSA wIntroduction: https:/ color by Industry/rstudio.github.io/leaflet/ <br>Markers: https://rstudio.github.io/leaflet/markers.html <br>Github: https://github.com/rstudio/leaflet <br> Features*Interactive panning/zooming*Compose maps using arbitrary combinations of: *Map tiles *Markers *Polygons *Lines *Popups *GeoJSON*Create maps right from the R console or RStudio*Embed maps in knitr/R Markdown documents and Shiny apps*Easily render Spatial objects from the sp package, or data frames with latitude/longitude columns*Use map bounds and mouse events to drive Shiny logic
*Sample Code: SBDE <- read.csv("SBDE.csv") #Import the CSV file with your data set library(RgoogleMapsleaflet)#Use the leaflet librarylibrary #data(SBDE) m <- leaflet(data = SBDE) %>% #Define your map with the data you specified earlier addTiles(ggplot2)%>% # Add default OpenStreetMap map tiles. Make sure to use the %>% symbol!library addMarkers(~longitude, ~latitude, popup = ~as.character(colorspacelink))%>% #Add points on your maplibrary addLegend(RColorBrewer"bottomright", colors= "#1878cd", labels="Resources", title="Houston Small Biz Guide")#Add a legend m # Print map