Objective of this excercise is to create a web page using R Markdown that features UK Cities on map created with Leaflet.
UK Cities data is taken/ filtered from world cities data provided by Maxmind to granularity of postcode level. More details can be found at https://www.maxmind.com/en/free-world-cities-database.
setwd("~/workspace/leaflet")
library(leaflet)
# Load data
ukcity <- read.csv("ukcitiespop.csv")
head(ukcity)
## Country City AccentCity Region Population Lat Long
## 1 gb abberley Abberley Q4 NA 52.30000 -2.366667
## 2 gb abberton Abberton E4 NA 51.83333 0.916667
## 3 gb abberton Abberton Q4 NA 52.18333 -2.016667
## 4 gb abbess roding Abbess Roding E4 NA 51.78333 0.266667
## 5 gb abbey-cwmhir Abbey-Cwmhir Y8 NA 52.33333 -3.400000
## 6 gb abbey dore Abbey Dore F7 NA 51.96667 -2.900000
ukcity %>%
leaflet() %>%
addTiles() %>%
addMarkers(clusterOption=markerClusterOptions())
## Assuming 'Long' and 'Lat' are longitude and latitude, respectively