In this report an interactive map is created using leaflet package. The map shows the Indian cities with population more than one million. The raw data is downloaded from https://simplemaps.com/data/in-cities. A subset of the data is used for the map.
library(dplyr)
## Warning: package 'dplyr' was built under R version 3.6.3
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(leaflet)
## Warning: package 'leaflet' was built under R version 3.6.3
library(xlsx)
## Warning: package 'xlsx' was built under R version 3.6.3
incity <- read.xlsx("incity.xlsx",sheetName = "data",header = TRUE)
citypos <- incity %>% select(city,lat,lng,population) %>% filter(population > 1000000)
seemap <- citypos %>% leaflet() %>% addTiles() %>% addCircles(weight = 1, radius = sqrt(citypos$population)* 30, popup = as.character(citypos$population/1000000))
## Assuming "lng" and "lat" are longitude and latitude, respectively
The population is shown in millions as you click on the place.