recode_nuts {regions} | R Documentation |
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 |
Defaults to |
nuts_year |
The year of the NUTS typology to use.
You can select any valid
NUTS definition, i.e. |
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
{
foo <- data.frame (
geo = c("FR", "DEE32", "UKI3" ,
"HU12", "DED",
"FRK"),
values = runif(6, 0, 100 ),
stringsAsFactors = FALSE )
recode_nuts(foo, nuts_year = 2013)
}