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 will show 4 cities in the South of Brazil, composed of three states: Paraná, Santa Catarina and Rio Grande do Sul.
The chosen cities are: Maringá, PR where is the Universidade Estadual de Magingá, which offers the only master’s degree in Biostatistics in Brazil, Curitiba, PR (capital), Florianópolis, SC (capital) and Porto Alegre, RS (capital).
library(leaflet)
lats<-c(-30.0277, -27.5969,-25.4284,-23.4273)
longs<-c(-51.2287,-48.5495,-49.2733,-51.9375)
places<-c('Porto Alegre', 'Florianópolis', 'Curitiba','Maringá')
states<-c('Rio Grande do Sul', 'Santa Catarina', 'Paraná','Paraná')
df<-data.frame(latitude=lats, longitude=longs, places=places, states=states, statecolor=c("blue","red","green","green") )
Plotting the map with 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 "longitude" and "latitude" are longitude and latitude, respectively
UEMicon <- makeIcon(iconUrl = "https://msrcos3s.neocities.org/uem-logo.png",
iconWidth = 35, iconHeight = 36,
iconAnchorX = 30, iconAnchorY = 16)
UEM <- data.frame(
latitude = c(-23.4037646),
longitude = c(-51.9377441))
UEM %>%
leaflet() %>%
addTiles() %>%
addMarkers(icon = UEMicon)