knitr::opts_chunk$set(echo = TRUE, collapse = TRUE, fig.width = 7, fig.height = 4, fig.align = "center", message = FALSE, warning = FALSE)
The CRAN version can be loaded as follows:
library('mapping')
or the development version from GitHub:
remotes::install_github('serafinialessio/mapping')
The worldwide geographical aggregates nomenclature are the following:
| Function argument | Aggregates | Level | ------------|------------| -------------| | "continent" | Continents | level 0 | | "regions" | World regions | level 1 | | "subregion" | World subregions | level 2 | | "country" | Countries | level 3 |
where level 0 is the largest unit (continent), and level 4 the smallest unit.
Countries can be subdivided in other aggregates, based on type of economics or development
| Function argument | Type |
------------|------------|
| "type" | Classification based on the type of political entity |
| "type_economy" | Classification based on the type of development |
| "type_income" | Classification based on the type of income |
and based on the belonging to some international organisation
| Function argument | Type |
------------|------------|
| "nato" | If is a NATO country |
| "ocde" | If is a ICDE country |
DiagrammeR::grViz(" digraph graph2 { graph [layout = dot, rankdir = LR] # node definitions with substituted label text node [shape = oval] a [label = 'continent'] b [label = 'regions'] c [label = 'subregion'] d [label = 'country'] d -> c -> b -> a } ",height = 100)
Level
may have names expressed in different way. The package provides:
| Names | Code |
------------|------------|
| Country names | country
|
| iso2 code | iso2
|
| iso3 code | iso3
|
| iso3 numeric | iso3_numeric
|
| iso3 United Nations | iso3_un
|
| iso2 World Bank | iso2_wb
|
| Formal name | name_formal
|
| World Bank name | name_wb
|
This can be specified in matchWith
argument, depending on the ids format in the input data.
wr_continent <- loadCoordWR(unit = "continent", res = "hi") mappingWR(wr_continent)
wr_regions <- loadCoordWR(unit = "region", res = "hi") mappingWR(wr_regions)
wr_subregion <- loadCoordWR(unit = "subregion", res = "hi") mappingWR(wr_subregion)
wr_country <- loadCoordWR(unit = "country", res = "hi") mappingWR(wr_country)
wr_nato <- loadCoordWR(unit = "nato", res = "hi") mappingWR(wr_nato)
wr_ocde <- loadCoordWR(unit = "ocde", res = "hi") mappingWR(wr_ocde)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.