-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathciv6Wonders.R
30 lines (19 loc) · 982 Bytes
/
civ6Wonders.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#Clear the workspace - remove all variables
rm(list = ls())
gc()
library('leaflet')
library('htmlwidgets')
wonders <- read.csv("civ6Wonders.csv", sep = ";", header = T)
wonders$img_qry <- paste0("https://www.google.com/search?tbm=isch&q=",gsub(" ","+",wonders$wonder))
civ6_map <- leaflet(wonders) %>%
addProviderTiles(providers$Esri.NatGeoWorldMap) %>%
addCircleMarkers(fillOpacity = 1,
label = wonders$wonder,
color = ~ifelse(type == "m", "blue", "green"),
group = ~ifelse(type == "m", "Human-made", "Natural"),
popup = paste0("<a href='" ,wonders$img_qry, "' target='_blank'><img src = 'img/", gsub(" ","",wonders$wonder), ".png'> </a>")
)%>%
addLayersControl(
overlayGroups = c("Natural","Human-made"),
options = layersControlOptions(collapsed = FALSE))
saveWidget(widget=civ6_map, file="index.html")