library(leaflet)
my_map <- leaflet() %>%
addTiles()
my_map
Add location of one tourist attraction
my_map <- my_map %>%
addTiles %>%
addMarkers(lat=41.4272, lng=-72.4287, popup = 'Gilette Castle')
my_map
Create data frame
set.seed(2018)
CtLatLong <- data.frame(
lat = c( 41.4272, 41.4916, 41.4745, 41.3543, 41.3733, 41.4850),
lng = c( -72.4287, -72.0915, -71.9599, -71.9665, -71.9533, -72.3373))
CtLatLong %>%
leaflet() %>%
addTiles() %>%
addMarkers()
Add multiple pop-ups
CTSites <- c(
"<a href='http://www.ct.gov/deep/cwp/view.asp?a=2716&q=325204&deepNav_GID=1650%20'>Gillette Castle</a>",
"<a href='https://mohegansun.com/'>Mohegan Sun Casino</a>",
"<a href='https://www.foxwoods.com/default.aspx'>Foxwoods Casino</a>",
"<a href='https://www.mysticseaport.org/'>Mystic Seaport</a>",
"<a href='http://www.mysticaquarium.org/'>Mystic Aquarium</a>",
"<a href='http://www.ct.gov/deep/cwp/view.asp?a=2716&q=325188&deepNav_GID=1650'>Devils Hopyard</a>"
)
CtLatLong %>%
leaflet %>%
addTiles() %>%
addMarkers(popup = CTSites)