Learn R Programming

mapping (version 1.4.1)

checkNamesWR: Check World country names

Description

Check the differences between the names (or codes) given in input and the names (or codes) of the worldwide countries.

Usage

checkNamesWR(id,
             unit = c("country", "nato", "ocde",
                      "continent", "region", "subregion",
                      "region_wb", "type_income", "type_economy"),
             matchWith = c("country", "iso2", "iso3", "iso3_eh",
                           "iso3_numeric", "iso3_un", "iso2_wb",
                           "iso3_wb", "name_formal", "name_wb"),
             res = c("low", "hi"), return_logical = FALSE,
             print = TRUE, use_internet = TRUE)

Value

Returns a string vector with no matched names or a boolean vector indicating whether or not the id matched.

Arguments

id

character vector with names or codes

unit

the type of world statistical unit

matchWith

the type of id to check:

"country"if country names
"iso2"if iso2 code
"iso3"if iso3 code.
"iso3_eh"if iso3_eh code
"iso3_numeric"if iso3 numeric code
"iso3_un"if iso3 United Nations
"iso2_wb"if iso2 World Bank
"iso3_wb"if iso3 World Bank
"name_formal"if formal names
"name_wb"if World Bank names

res

map resolution

return_logical

a logical value indicating whether nomatched id are returned

print

a logical value indicating whether print the nomatched names

use_internet

a logical value indicating wheter the coordinates are downloaded from https://github.com/mappinguniverse/geospatial. If FALSE the maps downloaded during package installation will be used.

Author

Alessio Serafini

Details

The function provides a check between id name in the dataset and the worldwide country names. The single unit can be coded in different ways, with names, id or iso standards.

See Also

checkNamesIT, checkNamesEU, checkNamesUS

Examples

Run this code
data("popWR")

ck <- checkNamesWR(id = popWR$country, matchWith = "country")
ck
ck1 <- checkNamesWR(id = popWR$country_code, matchWith = "iso3", return_logical = TRUE)
ck1

Run the code above in your browser using DataLab