Learn R Programming

mapping (version 1.4.1)

checkNamesEU: Check European names

Description

Check the differences between the names (or codes) given in input and the names (or codes), as provided by Eurostat, of the corresponding selected European statistical unit.

Usage

checkNamesEU(id,
             unit = c("nuts0", "nuts1", "nuts2", "nuts3", "urau"),
             year = c("2021","2016", "2013", "2010", "2006", "2003"),
             matchWith = c("nuts", "id", "iso2", "iso3", "country_code"),
             scale = c("20", "60"), return_logical = FALSE,
             print = TRUE, use_internet = TRUE)

Value

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

Arguments

id

character vector with names or codes

unit

the type of European statistical unit to check

year

year of the analysis

matchWith

the type of id to check:

"nuts"if nuts names
"id"if nuts id
"iso2"if iso2 code
"iso3"if iso3 code
"country_code"if Eurostat code

scale

the scale of the map.

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 European statistical unit. unit starts from the largest aggregate, "nuts0" (European country), to the smallest, "nuts3". Since unit can change over the years, the year of the data has to be provided.

The single unit can be coded in different ways, with names, id or iso standard.

See Also

checkNamesIT, checkNamesUS, checkNamesWR

Examples

Run this code
data("popEU")
data("popEUnuts2")

# Chech only the country
ck <- checkNamesEU(id = popEU$GEO,
                   unit = "nuts0", matchWith = "id")
ck1 <- checkNamesEU(id = popEU$GEO, unit = "nuts0",
                    matchWith = "id", return_logical = TRUE,
                    print = FALSE)

popEU[ck1,]

ck2 <- checkNamesEU(id = popEUnuts2$GEO,
                    unit = "nuts2",
                    matchWith = "id")

Run the code above in your browser using DataLab