Learn R Programming

regions (version 0.1.8)

recode_nuts: Recode Region Codes From Source To Target NUTS Typology

Description

Validate your geo codes, pair them with the appropriate standard typology, look up potential causes of invalidity in the EU correspondence tables, and look up the appropriate geographical codes in the other (target) typology. For example, validate geo codes in the 'NUTS2016' typology and translate them to the now obsolete the 'NUTS2010' typology to join current data with historical data sets.

Usage

recode_nuts(dat, geo_var = "geo", nuts_year = 2016)

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.

nuts_year

The year of the NUTS typology to use. You can select any valid NUTS definition, i.e. 1999, 2003, 2006, 2010, 2013, the currently used 2016 and the already announced and defined 2021. Defaults to the current typology in force, which is 2016.

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.

See Also

Other recode functions: get_country_code()

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)
}
# }

Run the code above in your browser using DataLab