Create a web page using R Markdown that features a map created with Leaflet. Host your webpage on either GitHub Pages, RPubs, or NeoCities. Your webpage must contain the date that you created the document, and it must contain a map created with Leaflet. We would love to see you show off your creativity!
I am creating a map that contains 20 randomly generated places around San Francisco which are randomly labeled in 3 different colors shown as circles in below chart.
library(leaflet)
library(tidyverse)
set.seed(12345)
df<-data.frame(
lat=runif(20, min=37.7, max=37.8),
lng=runif(20, min=-122.5, max=-122.4),
col=sample(c("red", "blue", "green"), 20, replace = TRUE),
stringsAsFactors=FALSE
)
df%>%
leaflet()%>%
addTiles()%>%
addCircleMarkers(col=df$col)%>%
addLegend(labels = LETTERS[1:3], colors=c("red", "blue", "green"))