Create a web page using R Markdown that features a map created with Leaflet.
Your webpage must contain the date that you created the document, and it must contain a map created with Leaflet.
library(leaflet)
## Warning: package 'leaflet' was built under R version 3.6.3
library(dplyr)
## Warning: package 'dplyr' was built under R version 3.6.3
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
I have marked my home and three nearest pharmacies on the map.
map <- leaflet() %>%
addTiles() %>%
addMarkers(lat = 21.134660, lng = 79.061279, popup = "My Home") %>%
addMarkers(lat = 21.134448, lng = 79.061309, popup = "Surabhi Medical Store") %>%
addMarkers(lat = 21.134001, lng = 79.061532, popup = "Happy Medicos") %>%
addMarkers(lat = 21.136524, lng = 79.060548, popup = "Renuka Medical Stores")
map
I have generated 500 random points in my city to demonstrate the clustering. You can zoom in to see the details.
set.seed(2020-05-30)
df <- data.frame(lat = runif(500,
min = 21.10,
max = 21.16),
lng = runif(500,
min = 79.02,
max = 79.09))
df %>%
leaflet() %>%
addTiles() %>%
addMarkers(clusterOptions = markerClusterOptions())