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 beaches in Brazil.
The data frame have 4 point with the geo-coordenates of my 4-top favorite beaches in Brazil. I placed the different beaches by color, in an order of beauty (trust me, I’m Brazilian and I’ve seen many beautiful beaches in my life).
library(leaflet)
lats<-c(-27.696695, -3.718654,-22.987191,-23.845236)
longs<-c(-48.465646,-38.513904,-43.219049,-45.414616)
places<-c('Ilha do Campeche', 'Praia de Iracema', 'Praia do Leblon','Praia da Feiticeira')
states<-c('Santa Catarina', 'Ceara', 'Rio de Janeiro','Sao Paulo')
df<-data.frame(lat=lats, lng=longs, places=places, states=states, statecolor=c("blue","red","green","yellow") )
Plot the map using leaflet.
df%>%leaflet()%>%addTiles()%>%addCircleMarkers(color=df$statecolor, popup = df$places) %>% addLegend(labels = states[1:4], colors=c("blue","red","green", "yellow")) %>% addProviderTiles(providers$OpenStreetMap)
## Assuming "lng" and "lat" are longitude and latitude, respectively