Author

Antoine Soetewey

Code
library(highcharter)
library(dplyr)
library(pander)
library(maps)

dat <- iso3166
dat <- rename(dat, "iso-a3" = a3)
countries_visited <- c("AUS", "BEL", "CAN", "CHE", "CZE", "DEU", "DNK", "ESP", "FIN", "FRA", "GBR", "GRC", "HUN", "IDN", "IRL", "ITA", "LVA", "LUX", "MCO", "MMR", "NLD", "NZL", "NOR", "PRT", "ROU", "SGP", "SWE", "TWN", "THA", "USA")
dat$visited <- ifelse(dat$`iso-a3` %in% countries_visited, 1, 0)

hcmap(
  map = "custom/world-highres3", # high resolution world map
  data = dat, # name of dataset
  joinBy = "iso-a3",
  value = "visited",
  showInLegend = FALSE, # hide legend
  nullColor = "#DADADA",
  download_map_data = TRUE
) %>%
  hc_mapNavigation(enabled = FALSE) %>%
  hc_legend("none") %>%
  hc_title(text = "World map") # title

Visited countries (in alphabetical order):

Code
not_visited <- c("Clipperton Island", "Azores", "Madeira Islands", "Canary Islands")
dat$visited <- ifelse(dat$mapname %in% not_visited, 0, dat$visited)
dat <- subset(dat, dat$visited == 1)
pander(sort(dat$ISOname))

Australia, Belgium, Canada, Czech Republic, Denmark, Finland, France, Germany, Greece, Hungary, Indonesia, Ireland, Italy, Latvia, Luxembourg, Monaco, Myanmar, Netherlands, New Zealand, Norway, Portugal, Romania, Singapore, Spain, Sweden, Switzerland, Taiwan, Thailand, United Kingdom of Great Britain and Northern Ireland and United States

Total: 30 countries.


See this tutorial to create your own map.

Go back to antoinesoetewey.com or statsandr.com.