This is an Coursera project defined as follow= “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!”library(leaflet)
## Warning: package 'leaflet' was built under R version 4.2.2
library(dplyr)
## Warning: package 'dplyr' was built under R version 4.2.2
se_cities = data.frame(name=c("Stockholm","Göteborg","Malmö","Uppsala","Väsby","Västerås","Örebro","Linköping"),
pop=c(1617407,607882,325069,166698,149701,128660,126604,115682),
lat= c(59.3293, 57.7089, 55.6040, 59.8588, 59.4919, 59.6099, 59.2741, 58.4108),
lng=c(18.0686, 11.9746, 13.0038, 17.6389, 17.9023, 16.5448, 15.2064, 15.6214))
m= se_cities %>% leaflet() %>% addTiles() %>% addMarkers(popup = ~paste(se_cities$name,", Population size: ",format(se_cities$pop,big.mark=","))) %>%addCircleMarkers(weight = 1,radius=~sqrt(se_cities$pop/1000) ,color=ifelse(se_cities$name=="Stockholm","red","blue")) %>% addLegend(position = "bottomright",colors = c("red","blue"),labels=c("Capital City", "Other cities"))
m