Learn R Programming

eurostat (version 3.7.10)

reexports: Recode Region Codes From Source To Target NUTS Typology

Description

These objects are imported from other packages. Follow the links below to see their documentation.

regions

recode_nuts, validate_geo_code, validate_nuts_regions

Arguments

dat

A data frame with a 3-5 character geo_var variable to be validated.

geo_var

Defaults to "geo". The variable that contains the 3-5 character geo codes to be validated.

geo

A vector of geographical code to validate.

nuts_year

A valid NUTS edition year.

Value

The original data frame with a 'geo_var' column is extended with a 'typology' column that states in which typology is the 'geo_var' a valid code. For invalid codes, looks up potential reasons of invalidity and adds them to the 'typology_change' column, and at last it adds a column of character vector containing the desired codes in the target typology, for example, in the NUTS2013 typology.

Returns the original dat data frame with a column that specifies the comformity with the NUTS definition of the year nuts_year.

A character list with the valid typology, or 'invalid' in the cases when the geo coding is not valid.

Details

While country codes are technically not part of the NUTS typologies, Eurostat de facto uses a NUTS0 typology to identify countries. This de facto typology has three exception which are handled by the validate_nuts_countries function.

NUTS typologies have different versions, therefore the conformity is validated with one specific versions, which can be any of these: 1999, 2003, 2006, 2010, 2013, the currently used 2016 and the already announced and defined 2021.

The NUTS typology was codified with the NUTS2003, and the pre-1999 NUTS typologies may confuse programmatic data processing, given that some NUTS1 regions were identified with country codes in smaller countries that had no NUTS1 divisions.

Currently the 2016 is used by Eurostat, but many datasets still contain 2013 and sometimes earlier metadata.

See Also

Other regions functions: add_nuts_level(), harmonize_geo_code(), recode_to_nuts_2013(), recode_to_nuts_2016()

Other regions functions: add_nuts_level(), harmonize_geo_code(), recode_to_nuts_2013(), recode_to_nuts_2016()

Other regions functions: add_nuts_level(), harmonize_geo_code(), recode_to_nuts_2013(), recode_to_nuts_2016()

Examples

Run this code
# NOT RUN {
{
foo <- data.frame (
  geo  =  c("FR", "DEE32", "UKI3" ,
            "HU12", "DED",
            "FRK"),
  values = runif(6, 0, 100 ),
  stringsAsFactors = FALSE )

recode_nuts(foo, nuts_year = 2013)
}
# }
# NOT RUN {
my_reg_data <- data.frame(
  geo = c(
    "BE1", "HU102", "FR1",
    "DED", "FR7", "TR", "DED2",
    "EL", "XK", "GB"
  ),
  values = runif(10)
)

validate_nuts_regions(my_reg_data)

validate_nuts_regions(my_reg_data, nuts_year = 2013)

validate_nuts_regions(my_reg_data, nuts_year = 2003)
# }
# NOT RUN {
my_reg_data <- data.frame(
  geo = c(
    "BE1", "HU102", "FR1",
    "DED", "FR7", "TR", "DED2",
    "EL", "XK", "GB"
  ),
  values = runif(10)
)

validate_geo_code(my_reg_data$geo)
# }

Run the code above in your browser using DataLab