Description

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 map is going to show my 4 top favorite places in the Patagonia, Argentina. . ## Loading library and data prepare

The data frame have 4 point with the geo-coordenates of my 4-top favorite places in Patagonia. The places includes the states in order use them for color.

library(leaflet)
lats<-c(-50.4967297, -54.8428951,-42.9737662,-42.7694476)
longs<-c(-73.1376612,-68.5537605,-71.6438134,-65.0317175)
places<-c('Calafate', 'Parque Nacional Tierra del Fuego', 'Parque nacional los alerces','Puerto Madryn')
states<-c('Santa Cruz', 'Tierra del Fuego', 'Chubut','Chubut')
df<-data.frame(lat=lats, lng=longs, places=places, states=states, statecolor=c("blue","red","green","green") )

Plot the map

Plot the map using leaflet.

df%>%leaflet()%>%addTiles()%>%addCircleMarkers(color=df$statecolor, popup = df$places) %>% addLegend(labels = states[1:3], colors=c("blue","red","green")) %>% addProviderTiles(providers$OpenStreetMap)
## Assuming 'lng' and 'lat' are longitude and latitude, respectively