Changes

Jump to navigation Jump to search
711 bytes added ,  13:34, 21 September 2020
no edit summary
[[Category:Internal]]{{Project|Has project output=|Has sponsor=McNair Center|Has title=Mapping on R|Has owner=Albert Nabiullin,|Has keywords=Tool|Has project status=Complete}}== Interactive Maps: ==
===Mapping with Leaflet===
[[Image:leaflet.jpgpng|200px|thumb|right|Interactive map on Leaflet]][[Image:marker.jpgpng|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.
Introduction: https://rstudio.github.io/leaflet/<br>Markers: https://rstudio.github.io/leaflet/markers.html<br>Github: https://github.com/rstudio/leaflet<br>
Features
*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(leaflet) #Use the leaflet library
#data(SBDE)
m <- leaflet(data = SBDE) %>% #Define your map with the data you specified earlier
addTiles() %>% # Add default OpenStreetMap map tiles. Make sure to use the %>% symbol!
addMarkers(~longitude, ~latitude, popup = ~as.character(link)) %>% #Add points on your map
addLegend("bottomright", colors= "#1878cd", labels="Resources", title="Houston Small Biz Guide") #Add a legend
m # Print map
Helpful links: http://www.r-bloggers.com/interactive-maps-for-the-web-in-r/<br>
To find HEX codes for RGB colors: http://www.javascripter.net/faq/rgbtohex.htm

Navigation menu