The goal of this assignment is to create a web page using R Markdown that features a map created with Leaflet. The webpage should be hosted on either Github Pages, RPubs, or NeoCities. The webpage must also contain the date when the document was created.
The map shows the 10 most populous cities in the Philippines. Hover on each location to see how large is the population of the city. The data was taken from https://worldpopulationreview.com/countries/cities/bangladesh The source code for this document can be viewed at my github repo
library(leaflet)
## Warning: package 'leaflet' was built under R version 3.6.3
library(readr)
## Warning: package 'readr' was built under R version 3.6.3
df <- read_csv("locations.csv")
## Parsed with column specification:
## cols(
## lat = col_double(),
## long = col_double(),
## popup = col_character(),
## population = col_double()
## )
df %>% leaflet() %>%
addTiles() %>%
addMarkers(
lat = df$lat,
lng = df$long,
popup = paste(df$popup, "<br>", "Population:", df$population),
clusterOptions = markerClusterOptions()) %>%
addCircleMarkers(radius = sqrt(df$population/10e3))
## Assuming "long" and "lat" are longitude and latitude, respectively