Skip to contents

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)

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.

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.

Value

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

Author

Alessio Serafini

Examples

data("popEU")
data("popEUnuts2")

# Chech only the country
ck <- checkNamesEU(id = popEU$GEO,
                   unit = "nuts0", matchWith = "id")
#> Warning: No match found for variables:  be1No match found for variables:  be10No match found for variables:  be100No match found for variables:  be2No match found for variables:  be21No match found for variables:  be211No match found for variables:  be212No match found for variables:  be213No match found for variables:  be22No match found for variables:  be221No match found for variables:  be222No match found for variables:  be223No match found for variables:  be23No match found for variables:  be231No match found for variables:  be232No match found for variables:  be233No match found for variables:  be234No match found for variables:  be235No match found for variables:  be236No match found for variables:  be24No match found for variables:  be241No match found for variables:  be242No match found for variables:  be25No match found for variables:  be251No match found for variables:  be252No match found for variables:  be253No match found for variables:  be254No match found for variables:  be255No match found for variables:  be256No match found for variables:  be257No match found for variables:  be258No match found for variables:  be3No match found for variables:  be31No match found for variables:  be310No match found for variables:  be32No match found for variables:  be321No match found for variables:  be322No match found for variables:  be323No match found for variables:  be324No match found for variables:  be325No match found for variables:  be326No match found for variables:  be327No match found for variables:  be33No match found for variables:  be331No match found for variables:  be332No match found for variables:  be334No match found for variables:  be335No match found for variables:  be336No match found for variables:  be34No match found for variables:  be341No match found for variables:  be342No match found for variables:  be343No match found for variables:  be344No match found for variables:  be345No match found for variables:  be35No match found for variables:  be351No match found for variables:  be352No match found for variables:  be353No match found for variables:  bg3No match found for variables:  bg31No match found for variables:  bg311No match found for variables:  bg312No match found for variables:  bg313No match found for variables:  bg314No match found for variables:  bg315No match found for variables:  bg32No match found for variables:  bg321No match found for variables:  bg322No match found for variables:  bg323No match found for variables:  bg324No match found for variables:  bg325No match found for variables:  bg33No match found for variables:  bg331No match found for variables:  bg332No match found for variables:  bg333No match found for variables:  bg334No match found for variables:  bg34No match found for variables:  bg341No match found for variables:  bg342No match found for variables:  bg343No match found for variables:  bg344No match found for variables:  bg4No match found for variables:  bg41No match found for variables:  bg411No match found for variables:  bg412No match found for variables:  bg413No match found for variables:  bg414No match found for variables:  bg415No match found for variables:  bg42No match found for variables:  bg421No match found for variables:  bg422No match found for variables:  bg423No match found for variables:  bg424No match found for variables:  bg425No match found for variables:  cz0No match found for variables:  cz01No match found for variables:  cz010No match found for variables:  cz02No match found for variables:  cz020No match found for variables:  cz03No match found for variables:  cz031No match found for variables:  cz032No match found for variables:  cz04No match found for variables:  cz041No match found for variables:  cz042No match found for variables:  cz05No match found for variables:  cz051No match found for variables:  cz052No match found for variables:  cz053No match found for variables:  cz06No match found for variables:  cz063No match found for variables:  cz064No match found for variables:  cz07No match found for variables:  cz071No match found for variables:  cz072No match found for variables:  cz08No match found for variables:  cz080No match found for variables:  dk0No match found for variables:  dk01No match found for variables:  dk011No match found for variables:  dk012No match found for variables:  dk013No match found for variables:  dk014No match found for variables:  dk02No match found for variables:  dk021No match found for variables:  dk022No match found for variables:  dk03No match found for variables:  dk031No match found for variables:  dk032No match found for variables:  dk04No match found for variables:  dk041No match found for variables:  dk042No match found for variables:  dk05No match found for variables:  dk050No match found for variables:  de1No match found for variables:  de11No match found for variables:  de111No match found for variables:  de112No match found for variables:  de113No match found for variables:  de114No match found for variables:  de115No match found for variables:  de116No match found for variables:  de117No match found for variables:  de118No match found for variables:  de119No match found for variables:  de11aNo match found for variables:  de11bNo match found for variables:  de11cNo match found for variables:  de11dNo match found for variables:  de12No match found for variables:  de121No match found for variables:  de122No match found for variables:  de123No match found for variables:  de124No match found for variables:  de125No match found for variables:  de126No match found for variables:  de127No match found for variables:  de128No match found for variables:  de129No match found for variables:  de12aNo match found for variables:  de12bNo match found for variables:  de12cNo match found for variables:  de13No match found for variables:  de131No match found for variables:  de132No match found for variables:  de133No match found for variables:  de134No match found for variables:  de135No match found for variables:  de136No match found for variables:  de137No match found for variables:  de138No match found for variables:  de139No match found for variables:  de13aNo match found for variables:  de14No match found for variables:  de141No match found for variables:  de142No match found for variables:  de143No match found for variables:  de144No match found for variables:  de145No match found for variables:  de146No match found for variables:  de147No match found for variables:  de148No match found for variables:  de149No match found for variables:  de2No match found for variables:  de21No match found for variables:  de211No match found for variables:  de212No match found for variables:  de213No match found for variables:  de214No match found for variables:  de215No match found for variables:  de216No match found for variables:  de217No match found for variables:  de218No match found for variables:  de219No match found for variables:  de21aNo match found for variables:  de21bNo match found for variables:  de21cNo match found for variables:  de21dNo match found for variables:  de21eNo match found for variables:  de21fNo match found for variables:  de21gNo match found for variables:  de21hNo match found for variables:  de21iNo match found for variables:  de21jNo match found for variables:  de21kNo match found for variables:  de21lNo match found for variables:  de21mNo match found for variables:  de21nNo match found for variables:  de22No match found for variables:  de221No match found for variables:  de222No match found for variables:  de223No match found for variables:  de224No match found for variables:  de225No match found for variables:  de226No match found for variables:  de227No match found for variables:  de228No match found for variables:  de229No match found for variables:  de22aNo match found for variables:  de22bNo match found for variables:  de22cNo match found for variables:  de23No match found for variables:  de231No match found for variables:  de232No match found for variables:  de233No match found for variables:  de234No match found for variables:  de235No match found for variables:  de236No match found for variables:  de237N
ck1 <- checkNamesEU(id = popEU$GEO, unit = "nuts0",
                    matchWith = "id", return_logical = TRUE,
                    print = FALSE)

popEU[ck1,]
#>      TIME GEO    total     male   female
#> 1    2019  BE 11455519  5644826  5810693
#> 60   2019  BG  7000039  3395701  3604338
#> 97   2019  CZ 10649800  5244194  5405606
#> 121  2019  DK  5806081  2889073  2917008
#> 139  2019  DE 83019213 40966691 42052522
#> 599  2019  EE  1324820   625635   699185
#> 607  2019  IE  4904240  2428881  2475359
#> 630  2019  EL 10724599  5208293  5516306
#> 700  2019  ES 46937060 23009259 23927801
#> 786  2019  FR 67012883 32386507 34626376
#> 1059 2019  HR  4076246  1972572  2103674
#> 1084 2019  IT 60359546 29384766 30974780
#> 1221 2019  CY   875899   427831   448068
#> 1225 2019  LV  1919968   884909  1035059
#> 1234 2019  LT  2794184  1295591  1498593
#> 1259 2019  LU   613894   308720   305174
#> 1263 2019  HU  9772756  4675821  5096935
#> 1301 2019  MT   493559   251836   241723
#> 1306 2019  NL 17282163  8581086  8701077
#> 1370 2019  AT  8858775  4357033  4501742
#> 1418 2019  PL 37972812 18380376 19592436
#> 1550 2019  PT 10276617  4852366  5424251
#> 1586 2019  RO 19414458  9500450  9914008
#> 1641 2019  SI  2080908  1038656  1042252
#> 1657 2019  SK  5450421  2661077  2789344
#> 1671 2019  FI  5517919  2723290  2794629
#> 1700 2019  SE 10230185  5142438  5087747
#> 1733 2019  UK 66647112 32901036 33746076
#> 1990 2019  IS   356991   182837   174154
#> 1995 2019  LI    38378    19025    19353
#> 1999 2019  NO  5328212  2685073  2643139
#> 2028 2019  CH  8544527  4237121  4307406
#> 2063 2019  ME   622182   307712   314470
#> 2067 2019  MK  2077132  1040200  1036932
#> 2081 2019  AL  2862427  1429594  1432833
#> 2101 2019  RS  6963764  3392811  3570953
#> 2133 2019  TR 82003882 41139980 40863902

ck2 <- checkNamesEU(id = popEUnuts2$GEO,
                    unit = "nuts2",
                    matchWith = "id")
#> Warning: No match found for variables:  hr04No match found for variables:  no01No match found for variables:  no03No match found for variables:  no04No match found for variables:  no05