Objective:

Create is a web page using R Markdown that features a map created with Leaflet, representing the 10 most populated cities of Argentina. Data set are obtained from “https://simplemaps.com/static/data/country-cities/ar/ar.csv”) In map, cities are represented by circles whose diameter is proportional to their population, and their popup gives the name of the city. ## Load data set

library(data.table)
data <- fread("https://simplemaps.com/static/data/country-cities/ar/ar.csv")
# order data by population number and filer the first ten.
data <- data[order(-population),][1:10,]

Map plotting with data

library(leaflet)

my_map <- data %>%
        leaflet() %>%
        addTiles() %>%
        setView(lng = -64, lat = -31, zoom = 5) %>%
        addMarkers(popup = data$city, 
                  lng = data$lng, 
                  lat = data$lat)  %>% 
        addCircles(weight=1,radius=sqrt(data$population)*100)
## Assuming "lng" and "lat" are longitude and latitude, respectively
 my_map