R Introduction

To create a web page using R Markdown that features a map created with Leaflet, and host webpage on either GitHub Pages, RPubs, or NeoCities,

In this project, I am going to the Hong Kong map, and the data from the website: https://gadm.org/download_country_v3.html

R Output

hkmap <- readRDS("/cloud/project/gadm36_HKG_1_sp.rds")
class(hkmap)
## [1] "SpatialPolygonsDataFrame"
## attr(,"package")
## [1] "sp"

Map of Hong Kong

The map of Hong Kong gives you have a better understanding for the districts before you look at the leaflet.

ggplot(hkmap, aes(long, lat, group=group, fill=id)) +

geom_polygon(show.legend = F) +

ggtitle(“Map of Hong Kong”)

The map shows 18 district with different color.

The map is in my website link below:

http://rpubs.com/yip999341/494151

Leaflet

library(leaflet)

leaflet(data = hkmap) %>% addTiles() %>%

The Hong Kong leaflet shows in my Rpubs website below:

http://rpubs.com/yip999341/494145

In this project, I want to shows one of the city in Asia(Hong Kong) which include 18 districts.