R Markdown and Leaflet
INSTRUCTION: Create a web page using R Markdown that features a map created with Leaflet. Host your webpage on either GitHub Pages, RPubs, or NeoCities. Your webpage must contain the date that you created the document, and it must contain a map created with Leaflet. We would love to see you show off your creativity!
library(leaflet)## Warning: package 'leaflet' was built under R version 4.1.3
Top 4 Universities in the Philippines Main Campuses
University logos as custom markers in the map.
UP_icon <- makeIcon(
iconUrl = "https://upload.wikimedia.org/wikipedia/en/thumb/3/3d/University_of_The_Philippines_seal.svg/640px-University_of_The_Philippines_seal.svg.png",
iconWidth = 50, iconHeight = 50,
iconAnchorX = 50*215/230/2, iconAnchorY = 25
)
ADMU_icon <- makeIcon(
iconUrl = "https://upload.wikimedia.org/wikipedia/en/thumb/6/6c/Ateneo_de_Manila_University_seal.svg/1200px-Ateneo_de_Manila_University_seal.svg.png",
iconWidth = 50, iconHeight = 50,
iconAnchorX = 50*215/230/2, iconAnchorY = 25
)
DLSU_icon <- makeIcon(
iconUrl = "https://upload.wikimedia.org/wikipedia/en/thumb/c/c2/De_La_Salle_University_Seal.svg/1200px-De_La_Salle_University_Seal.svg.png",
iconWidth = 50, iconHeight = 50,
iconAnchorX = 50*215/230/2, iconAnchorY = 25
)
UST_icon <- makeIcon(
iconUrl = "https://preview.redd.it/ss0xjc3h60f41.png?auto=webp&s=8afbd67ecf61c818f4db572bb99a9ca48ec3f9d4",
iconWidth = 50, iconHeight = 55,
iconAnchorX = 50*215/230/2, iconAnchorY = 25
)The maps shows the main campuses of the top four universities in the Philippines
top_univ_ph <- leaflet() %>%
addTiles() %>%
addMarkers(lat=14.6539, lng=121.0685, popup="University of the Philippines", icon = UP_icon) %>%
addMarkers(lat = 14.6395, lng = 121.0781, popup = "Ateneo de Manila University", icon = ADMU_icon) %>%
addMarkers(lat = 14.5647, lng = 120.9932, popup = "De La Salle University", icon = DLSU_icon) %>%
addMarkers(lat = 14.6095, lng = 120.9898, popup = "University of Santo Tomas", icon = UST_icon)
top_univ_ph