---
title: "Visited countries"
author: "Antoine Soetewey"
# date: "`r Sys.Date()`"
format:
html:
toc: true
# toc-depth: 6
number-sections: true
code-fold: true
code-tools: true
# theme: flatly
# highlight-style: tango
self-contained: true
citations-hover: true
citation-location: margin
---
```{r setup, include=FALSE}
knitr:: opts_chunk$ set (
fig.align = "center" ,
out.width = "100%" ,
tidy = "styler" ,
warning = FALSE ,
message = FALSE
)
set.seed (42 )
```
```{r, message = FALSE, warning = FALSE}
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):
```{r}
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))
```
Total: `r sum(dat$visited)` countries.
<br>
See this [ tutorial ](https://statsandr.com/blog/world-map-of-visited-countries-in-r/) to create your own map.
Go back to [ antoinesoetewey.com ](https://antoinesoetewey.com/) or [ statsandr.com ](https://statsandr.com/) .