Developing Data Products-Week 2-Assignment

Instructions

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!

My submission

Here are Central Park, Times Square, Empire State Building, Statue of Liberty, and Queens, some of the famous spots of New York City.

library(leaflet)
my_map <- leaflet() %>%
  addTiles() %>%
addMarkers(lat=40.7128, lng=-74.0060, popup = "New York City")%>%
  addMarkers(lat=40.7812, lng=-73.9665, popup="Central Park, NYC") %>%
  addMarkers(lat=40.7580,lng=-73.9855, popup="Times Square, NYC") %>%
  addMarkers(lat=40.7484,lng=-73.9857, popup="Empire State Building") %>%
  addMarkers(lat=40.6892,lng=-74.0445, popup="Statue of Liberty") %>%
  addMarkers(lat=40.7282,lng=-73.7949, popup="Queens,NYC")

my_map

Creating clusters

set.seed(1)
df <- data.frame(lat=runif(500, min=40.68, max = 40.79 ),
                 lng=runif(500, min=-74.05, max = -73.9 ))
head(df)
##        lat       lng
## 1 40.70921 -73.96687
## 2 40.72093 -73.94676
## 3 40.74301 -73.95129
## 4 40.77990 -73.95050
## 5 40.70219 -73.97916
## 6 40.77882 -73.90457
df %>%
leaflet() %>%
addTiles() %>%  
addMarkers(clusterOptions = markerClusterOptions())