Mapping 2011 Population Data for 10 Most populated towns in West Sussex (UK)
library(leaflet)
## Warning: package 'leaflet' was built under R version 4.0.5
df <- data.frame(
town = c("Worthing",
"Crawley",
"Bognor Regis",
"Littlehampton",
"Shoreham-by-Sea",
"Horsham",
"Haywards Heath",
"Burgess Hill",
"East Grinstead",
"Chichester"),
pop = c(109120,
106943,
63885,
55706,
48487,
48041,
33845,
30635,
29084,
28675),
lat = c(50.82046,
51.11187,
50.78372,
50.81220,
50.83552,
51.06536,
51.00010,
50.95455,
51.13113,
50.84008
),
lng = c(-0.37297,
-0.18681,
-0.67289,
-0.53874,
-0.27159,
-0.32656,
-0.10639,
-0.12872,
-0.01457,
-0.77493
)
)
myMap <- df %>%
leaflet() %>%
addTiles() %>%
addCircles(
weight = 1,
radius = ~pop * 0.06,
label = ~pop
)
## Assuming "lng" and "lat" are longitude and latitude, respectively
myMap