World population from:

kaggle world population

world_population <- read.csv(file = "world_population.csv", header = TRUE, sep = ",")

Countries from:

kaggle countries

countries <- read.csv(file = "countries.csv", header = TRUE, sep = ",")

countries <- countries[,c("Country","Latitude","Longitude")]

countries2 <- merge(countries, world_population, by.x = "Country", by.y = "Country.Other")

We keep the Top 50 countries with more population:

countries2 <- arrange(countries2, desc(Population..2020.))

top50 <- countries2[1:50, c("Country","Latitude","Longitude","Population..2020.")]

top50$Ranking <- seq(1:nrow(top50))

We see the Top 50 countries with more population:

top50 %>%
        leaflet() %>%
        addTiles() %>%
        addMarkers(popup=paste
        ("<br>Ranking: ", 
                formatC(top50$Ranking, format = "d"),
        "<br>Country: ", 
                htmlEscape(top50$Country), 
        "<br>Population: ", 
                formatC(top50$Population..2020., format = "d", big.mark = ".", decimal.mark = ",") 
        ) , lat= top50$Latitude, lng = top50$Longitude )