diff --git a/articles/nuts_files/figure-html/unnamed-chunk-35-1.png b/articles/nuts_files/figure-html/unnamed-chunk-35-1.png index 65a46ff..f36f784 100644 Binary files a/articles/nuts_files/figure-html/unnamed-chunk-35-1.png and b/articles/nuts_files/figure-html/unnamed-chunk-35-1.png differ diff --git a/pkgdown.yml b/pkgdown.yml index 7925fa3..9ed1872 100644 --- a/pkgdown.yml +++ b/pkgdown.yml @@ -3,7 +3,7 @@ pkgdown: 2.0.7 pkgdown_sha: ~ articles: nuts: nuts.html -last_built: 2024-03-01T12:46Z +last_built: 2024-03-01T12:55Z urls: reference: https://aaoritz.github.io/nuts/reference article: https://aaoritz.github.io/nuts/articles diff --git a/reference/nuts_test_multiple_versions.html b/reference/nuts_test_multiple_versions.html index 1e39bd6..8d8353e 100644 --- a/reference/nuts_test_multiple_versions.html +++ b/reference/nuts_test_multiple_versions.html @@ -91,7 +91,7 @@

Examplesdf <- manure %>% filter(nchar(geo) == 5) %>% select(geo, indic_ag, values) %>% - distinct(geo, .keep_all = T) %>% + distinct(geo, .keep_all = TRUE) %>% nuts_classify(nuts_code = "geo", group_vars = "indic_ag", data = .) diff --git a/search.json b/search.json index c9d876c..74a4e16 100644 --- a/search.json +++ b/search.json @@ -1 +1 @@ -[{"path":"https://aaoritz.github.io/nuts/CONTRIBUTING.html","id":null,"dir":"","previous_headings":"","what":"Contributing to nuts","title":"Contributing to nuts","text":"outlines propose change nuts.","code":""},{"path":"https://aaoritz.github.io/nuts/CONTRIBUTING.html","id":"fixing-typos","dir":"","previous_headings":"","what":"Fixing typos","title":"Contributing to nuts","text":"can fix typos, spelling mistakes, grammatical errors documentation directly using GitHub web interface, long changes made source file. generally means ’ll need edit roxygen2 comments .R, .Rd file. can find .R file generates .Rd reading comment first line.","code":""},{"path":"https://aaoritz.github.io/nuts/CONTRIBUTING.html","id":"bigger-changes","dir":"","previous_headings":"","what":"Bigger changes","title":"Contributing to nuts","text":"want make bigger change, ’s good idea first file issue make sure someone team agrees ’s needed. ’ve found bug, please file issue illustrates bug minimal reprex (also help write unit test, needed).","code":""},{"path":"https://aaoritz.github.io/nuts/CONTRIBUTING.html","id":"pull-request-process","dir":"","previous_headings":"Bigger changes","what":"Pull request process","title":"Contributing to nuts","text":"Fork package clone onto computer. haven’t done , recommend using usethis::create_from_github(\"AAoritz/nuts\", fork = TRUE). Install development dependencies devtools::install_dev_deps(), make sure package passes R CMD check running devtools::check(). R CMD check doesn’t pass cleanly, ’s good idea ask help continuing. Create Git branch pull request (PR). recommend using usethis::pr_init(\"brief-description--change\"). Make changes, commit git, create PR running usethis::pr_push(), following prompts browser. title PR briefly describe change. body PR contain Fixes #issue-number. user-facing changes, add bullet top NEWS.md (.e. just first header). Follow style described https://style.tidyverse.org/news.html.","code":""},{"path":"https://aaoritz.github.io/nuts/CONTRIBUTING.html","id":"code-style","dir":"","previous_headings":"Bigger changes","what":"Code style","title":"Contributing to nuts","text":"use roxygen2, Markdown syntax, documentation. use testthat unit tests. Contributions test cases included easier accept.","code":""},{"path":"https://aaoritz.github.io/nuts/CONTRIBUTING.html","id":"code-of-conduct","dir":"","previous_headings":"","what":"Code of Conduct","title":"Contributing to nuts","text":"Please note package released Contributor Code Conduct. contributing project, agree abide terms.","code":""},{"path":"https://aaoritz.github.io/nuts/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2024 nuts authors Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"https://aaoritz.github.io/nuts/articles/nuts.html","id":"key-features","dir":"Articles","previous_headings":"","what":"Key Features","title":"nuts: Convert European Regional Data in R","text":"Efficient offline conversion European regional data. Conversion five NUTS versions: 2006, 2010, 2013, 2016, 2021. Conversion three regional levels: NUTS-1, NUTS-2, NUTS-3. Ability convert multiple NUTS versions e.g. NUTS versions differ across countries years. scenario common working data sourced EUROSTAT. (Dasymetric) Spatial interpolation based five weights (regional area size, 2011 2018 population size, 2012 2018 built-area) built granular [100m x 100m] geodata European Commission’s Joint Research Center (JRC).","code":""},{"path":"https://aaoritz.github.io/nuts/articles/nuts.html","id":"nuts-codes","dir":"Articles","previous_headings":"","what":"NUTS Codes","title":"nuts: Convert European Regional Data in R","text":"Nomenclature Territorial Units Statistics (NUTS) geocode standard referencing administrative divisions European countries. NUTS code starts two-letter combination indicating country.1 administrative subdivisions, levels, referred additional number capital letter (NUTS-1). second (NUTS-2) third (NUTS-3) subdivision level referred another digit . example, German district Northern Saxony (Nordsachsen) located within region Leipzig federate state Saxony. DED: Saxony DED5: Leipzig DED53: Northern Saxony Since administrative boundaries Europe change demographic, economic, political reasons, five different versions NUTS Nomenclature (2006, 2010, 2013, 2016, 2021). current version, effective 1 January 2021, lists 104 regions NUTS-1, 283 regions NUTS-2, 1 345 regions NUTS-3 level2.","code":""},{"path":"https://aaoritz.github.io/nuts/articles/nuts.html","id":"spatial-interpolation-in-a-nutshell","dir":"Articles","previous_headings":"NUTS Codes","what":"Spatial interpolation in a nutshell","title":"nuts: Convert European Regional Data in R","text":"administrative units restructured, regional data measured within old boundaries can converted new boundaries reasonable assumptions. main task package use (dasymetric) spatial interpolation accomplish . Let’s take example German state Saxony figures . , NUTS-2 regions Leipzig (DED3 → DED5) Chemnitz (DED1 → DED4) reorganized. interested number manure storage facilities 2003 provided EUROSTAT based 2006 NUTS version. part Leipzig reassigned Chemnitz (center plot), prompting us recalculate number storage facilities 2010 version (right plot). simple approach redistribute manure storage facilities proportional transferred area, assuming equal distribution manure storages across space. dasymetric approach, make use built-area, assuming manure deposits likely found close residential areas economic sites. example, Leipzig lost 7.7% (\\(\\frac{5574}{72360}\\)) built-area. re-calculate number manure storage facilities computing 7.7% Leipzig’s manure storages \\(\\frac{5574}{72360} * 700 = 54\\), subtracting Leipzig adding Chemnitz. See Section Spatial interpolation detail -depth description weighting procedure. Holdings Manure Storage Facilities; BU = Built-Area \\(m^{2}\\); Sources: Shapefiles data EUROSTAT; Created using sf package.","code":""},{"path":"https://aaoritz.github.io/nuts/articles/nuts.html","id":"usage","dir":"Articles","previous_headings":"","what":"Usage","title":"nuts: Convert European Regional Data in R","text":"package comes three main functions: nuts_classify() detects NUTS version(s) level(s) data set. output can directly fed two functions. nuts_convert_version() converts data desired NUTS version (2006, 2010, 2013, 2016, 2021). transformation works direction. nuts_aggregate() aggregates data upper-level NUTS code, .e., transforms NUTS-3 data NUTS-2 NUTS-1 level (vice versa).","code":""},{"path":"https://aaoritz.github.io/nuts/articles/nuts.html","id":"workflow","dir":"Articles","previous_headings":"Usage","what":"Workflow","title":"nuts: Convert European Regional Data in R","text":"conversion can conducted classifying NUTS version(s) level(s) data using function nuts_classify(). step ensures validity completeness NUTS codes proceeding conversion. Sequential workflow convert regional NUTS data","code":""},{"path":"https://aaoritz.github.io/nuts/articles/nuts.html","id":"identifying-nuts-version-and-level","dir":"Articles","previous_headings":"Usage","what":"Identifying NUTS version and level","title":"nuts: Convert European Regional Data in R","text":"nuts_classify() function’s main purpose find suitable NUTS version identify level data set. , see example using patent application data (per one million inhabitants) Norway 2012 NUTS-2 level. data provided EUROSTAT. function returns list three items. items can called directly output object (data$...) retrieved using three helper functions nuts_get_data(), nuts_get_version(), nuts_get_missing(). first item gives original data set augmented columns from_version, from_level, country, indicating NUTS version best suits data. functions package always group NUTS codes across country names automatically generated provided NUTS codes. , see data entries correspond 2016 NUTS version. second item provides overview share matching NUTS codes five existing NUTS versions. overlap computed within country possibly additional groups (provided via group_vars argument). third item gives NUTS codes missing across groups. missing codes might lead conversion errors , default, omitted conversion procedures. example, NUTS codes missing.","code":"# Load packages library(nuts) library(dplyr) library(stringr) # Loading and subsetting Eurostat data data(patents, package = \"nuts\") pat_n2 <- patents %>% filter(nchar(geo) == 4) # NUTS-2 values pat_n2_mhab_12_no <- pat_n2 %>% filter(unit == \"P_MHAB\") %>% # Patents per one million inhabitants filter(time == 2012) %>% # 2012 filter(str_detect(geo, \"^NO\")) %>% # Norway select(-unit) # Classifying the Data pat_classified <- nuts_classify( data = pat_n2_mhab_12_no, nuts_code = \"geo\" ) # pat_classified$data # Call list item directly or... nuts_get_data(pat_classified) # ...use helper function ## # A tibble: 7 × 6 ## from_code from_version from_level country time values ## ## 1 NO01 2016 2 Norway 2012 125. ## 2 NO02 2016 2 Norway 2012 13.2 ## 3 NO03 2016 2 Norway 2012 57.4 ## 4 NO04 2016 2 Norway 2012 110. ## 5 NO05 2016 2 Norway 2012 48.9 ## 6 NO06 2016 2 Norway 2012 145. ## 7 NO07 2016 2 Norway 2012 16.5 # pat_classified$versions_data # Call list item directly or... nuts_get_version(pat_classified) # ...use helper function ## # A tibble: 5 × 3 ## from_version country overlap_perc ## ## 1 2016 Norway 100 ## 2 2013 Norway 100 ## 3 2010 Norway 100 ## 4 2006 Norway 100 ## 5 2021 Norway 42.9 # pat_classified$missing_data # Call list item directly or... nuts_get_missing(pat_classified) # ...use helper function ## # A tibble: 0 × 4 ## # ℹ 4 variables: from_code , from_version , ## # from_level , country "},{"path":"https://aaoritz.github.io/nuts/articles/nuts.html","id":"converting-data-between-nuts-versions","dir":"Articles","previous_headings":"Usage","what":"Converting data between NUTS versions","title":"nuts: Convert European Regional Data in R","text":"NUTS version level original data identified, can easily convert data NUTS version. example transforming 2013 Norwegian data 2021 NUTS version. 2016 2021, number NUTS-2 regions Norway decreased one borders six regions transformed. maps show affected regions. provide classified NUTS data, specify target NUTS version data transformation, supply variable containing values interpolated. important indicate variable type named input-vector since interpolation approaches differ absolute relative values. Converting patent data versions; Sources: Shapefiles data EUROSTAT; Created using sf package. output displays corresponding data frames based original converted NUTS codes. original data set comprises seven observations, whereas converted data set contains six. regions NO01, NO03, NO04, NO05 lost, NO08, NO09, NO0A now listed.","code":"# Converting Data to 2021 NUTS version pat_converted <- nuts_convert_version( data = pat_classified, to_version = \"2021\", variables = c(\"values\" = \"relative\") ) pat_n2_mhab_12_no ## # A tibble: 7 × 3 ## geo time values ## ## 1 NO01 2012 125. ## 2 NO02 2012 13.2 ## 3 NO03 2012 57.4 ## 4 NO04 2012 110. ## 5 NO05 2012 48.9 ## 6 NO06 2012 145. ## 7 NO07 2012 16.5 pat_converted ## # A tibble: 6 × 4 ## to_code to_version country values ## ## 1 NO02 2021 Norway 13.2 ## 2 NO06 2021 Norway 143. ## 3 NO07 2021 Norway 16.5 ## 4 NO08 2021 Norway 71.0 ## 5 NO09 2021 Norway 83.0 ## 6 NO0A 2021 Norway 58.9"},{"path":"https://aaoritz.github.io/nuts/articles/nuts.html","id":"converting-multiple-variables-simultaneously","dir":"Articles","previous_headings":"Usage > Converting data between NUTS versions","what":"Converting multiple variables simultaneously","title":"nuts: Convert European Regional Data in R","text":"can also convert multiple variables . , add number patent applications per 1000 inhabitants second variable:","code":"# Converting Multiple Variables pat_n2_mhab_12_no %>% mutate(values_per_thous = values * 1000) %>% nuts_classify( data = ., nuts_code = \"geo\" ) %>% nuts_convert_version( data = ., to_version = \"2021\", variables = c(\"values\" = \"relative\", \"values_per_thous\" = \"relative\") ) ## # A tibble: 6 × 5 ## to_code to_version country values values_per_thous ## ## 1 NO02 2021 Norway 13.2 13239 ## 2 NO06 2021 Norway 143. 143106. ## 3 NO07 2021 Norway 16.5 16463 ## 4 NO08 2021 Norway 71.0 71037. ## 5 NO09 2021 Norway 83.0 82964. ## 6 NO0A 2021 Norway 58.9 58904."},{"path":"https://aaoritz.github.io/nuts/articles/nuts.html","id":"converting-grouped-data","dir":"Articles","previous_headings":"Usage > Converting data between NUTS versions","what":"Converting grouped data","title":"nuts: Convert European Regional Data in R","text":"Longitudinal regional data, commonly supplied EUROSTAT, often comes varying NUTS versions across countries years (dimensions). possible harmonize data across groups group_vars argument nuts_classify(). , transform data within country year groups Sweden, Slovenia, Croatia 2021 NUTS version. Note detected best-fitting NUTS versions differ across countries: grouping stored passed conversion function: Conveniently, group argument can also used transform higher dimensional data. , include two indicators patent applications convert data varies indicator-year-country-NUTS code level.","code":"# Classifying grouped data (time) pat_n2_mhab_sesihr <- pat_n2 %>% filter(unit == \"P_MHAB\") %>% filter(str_detect(geo, \"^SE|^SI|^HR\")) pat_classified <- nuts_classify(nuts_code = \"geo\", data = pat_n2_mhab_sesihr, group_vars = \"time\") nuts_get_data(pat_classified) %>% group_by(country, from_version) %>% tally() ## # A tibble: 3 × 3 ## # Groups: country [3] ## country from_version n ## ## 1 Croatia 2016 24 ## 2 Slovenia 2010 26 ## 3 Sweden 2021 104 # Converting grouped data (Time) pat_converted <- nuts_convert_version( data = pat_classified, to_version = \"2021\", variables = c(\"values\" = \"relative\") ) # Classifying and converting multi-group data pat_n2_mhabmact_12_sesihr <- pat_n2 %>% filter(unit %in% c(\"P_MHAB\", \"P_MACT\")) %>% filter(str_detect(geo, \"^SE|^SI|^HR\")) pat_converted <- pat_n2_mhabmact_12_sesihr %>% nuts_classify( data = ., nuts_code = \"geo\", group_vars = c(\"time\", \"unit\") ) %>% nuts_convert_version( data = ., to_version = \"2021\", variables = c(\"values\" = \"relative\") )"},{"path":"https://aaoritz.github.io/nuts/articles/nuts.html","id":"converting-data-between-nuts-levels","dir":"Articles","previous_headings":"Usage","what":"Converting data between NUTS levels","title":"nuts: Convert European Regional Data in R","text":"nuts_aggregate() function facilitates aggregation data lower NUTS levels higher ones using spatial weights. enables users summarize variables upward NUTS-3 level NUTS-2 NUTS-1 levels. important note function support disaggregation since comes strong assumptions spatial distribution variable’s values. following example, illustrate aggregate total number patent applications Sweden NUTS-3 higher levels. functions return warning concerning non-identifiable NUTS codes. See Non-identified NUTS codes information. Aggregating patents NUTS 3 NUTS 2 NUTS 1; Sources: Shapefiles data EUROSTAT; Created using sf package.","code":"data(\"patents\", package = \"nuts\") # Aggregating data from NUTS-3 to NUTS-2 and NUTS-1 pat_n3 <- patents %>% filter(nchar(geo) == 5) pat_n3_nr_12_se <- pat_n3 %>% filter(unit %in% c(\"NR\")) %>% filter(time == 2012) %>% filter(str_detect(geo, \"^SE\")) pat_classified <- nuts_classify( data = pat_n3_nr_12_se, nuts_code = \"geo\" ) pat_level2 <- nuts_aggregate( data = pat_classified, to_level = 2, variables = c(\"values\" = \"absolute\") ) pat_level1 <- nuts_aggregate( data = pat_classified, to_level = 1, variables = c(\"values\" = \"absolute\") )"},{"path":[]},{"path":"https://aaoritz.github.io/nuts/articles/nuts.html","id":"nuts_not_identified","dir":"Articles","previous_headings":"Usage > Inconsistent versions and levels","what":"Non-identified NUTS codes","title":"nuts: Convert European Regional Data in R","text":"input data contains NUTS codes identified NUTS version, output classify_nuts lists codes. conversion procedures (nuts_convert_version() nuts_aggregate()) work expected ignoring values regions. example classifies 2012 patent data Denmark. original EUROSTAT data contains codes DKZZZ DKXXX, part conversion matrices. Codes ending letter Z refer “Extra-Regio” territories. codes collect statistics territories attached certain region.3 Codes ending letter X refer observations unknown regions.","code":"pat_n3.nr.12.dk <- pat_n3 %>% filter(unit %in% c(\"NR\")) %>% filter(time == 2012) %>% filter(str_detect(geo, \"^DK\")) pat_classified <- nuts_classify( data = pat_n3.nr.12.dk, nuts_code = \"geo\" )"},{"path":"https://aaoritz.github.io/nuts/articles/nuts.html","id":"missing-nuts-codes","dir":"Articles","previous_headings":"Usage > Inconsistent versions and levels","what":"Missing NUTS codes","title":"nuts: Convert European Regional Data in R","text":"nuts_classify() also checks whether NUTS codes provided complete. Missing values input data , default, result missing values affected transformed regions output data. example illustrates case. nuts_classify() returns warning NUTS codes missing input data. codes can inspected calling nuts_get_missing(pat_classified). resulting conversion returns three missing values source code SI011 transformed SI031 region SI016 split SI036 SI037. Users three options overcome problem. warning can ignored conversion proceeds returning NAs (see ). Users check whether missing values can replaced , e.g., using alternative sources imputing missing values. argument missing_rm can set TRUE. case, missing values removed input data. Effectively, interpolation procedures assume missing values can replaced 0, may strong assumption depending context.","code":"pat_n3_nr_12_si <- pat_n3 %>% filter(unit %in% c(\"NR\")) %>% filter(time == 2012) %>% filter(str_detect(geo, \"^SI\")) pat_classified <- nuts_classify( data = pat_n3_nr_12_si, nuts_code = \"geo\" ) nuts_get_missing(pat_classified) ## # A tibble: 2 × 4 ## from_code from_version from_level country ## ## 1 SI011 2010 3 Slovenia ## 2 SI016 2010 3 Slovenia nuts_convert_version( data = pat_classified, to_version = \"2021\", variables = c(\"values\" = \"absolute\") ) %>% filter(is.na(values)) ## # A tibble: 3 × 4 ## to_code to_version country values ## ## 1 SI031 2021 Slovenia NA ## 2 SI036 2021 Slovenia NA ## 3 SI037 2021 Slovenia NA nuts_convert_version( data = pat_classified, to_version = \"2021\", variables = c(\"values\" = \"absolute\"), missing_rm = TRUE ) %>% filter(to_code %in% c(\"SI031\", \"SI036\", \"SI037\")) ## # A tibble: 3 × 4 ## to_code to_version country values ## ## 1 SI031 2021 Slovenia 0 ## 2 SI036 2021 Slovenia 0.544 ## 3 SI037 2021 Slovenia 4.02"},{"path":"https://aaoritz.github.io/nuts/articles/nuts.html","id":"multiple-nuts-levels-within-groups","dir":"Articles","previous_headings":"Usage > Inconsistent versions and levels","what":"Multiple NUTS levels within groups","title":"nuts: Convert European Regional Data in R","text":"package allow conversion multiple NUTS levels . classification function throw error case. conversion needs conducted every level separately.","code":"patents %>% filter(nchar(geo) %in% c(4, 5), grepl(\"^EL\", geo)) %>% distinct(geo, .keep_all = T) %>% nuts_classify(nuts_code = \"geo\", data = .) ## Error in `nuts_classify()`: ## ! Data contains NUTS codes from multiple levels (2 and 3)."},{"path":"https://aaoritz.github.io/nuts/articles/nuts.html","id":"multiple-nuts-versions-within-groups","dir":"Articles","previous_headings":"Usage > Inconsistent versions and levels","what":"Multiple NUTS versions within groups","title":"nuts: Convert European Regional Data in R","text":"Converting multiple NUTS versions within groups might lead erroneous spatial interpolations since overlaps regions different versions possible. example illustrates problem. classify German Italian manure storage facility data EUROSTAT without specifying group_vars. Instead, keep unique NUTS codes artificially create data set containing different NUTS versions. nuts_classify() returns warning inspecting identified versions, see mixed versions within groups (countries). proceeding conversion either nuts_convert_version() nuts_aggregate(), functions throw error. convenience, added option multiple_versions subsets supplied data dominant version within groups specified most_frequent. Hence, codes , non-dominant versions discarded. convert data set, NUTS regions unrecognized according 2006 (Germany) 2021 (Italy) version dropped automatically.","code":"man_deit <- manure %>% filter(grepl(\"^DE|^IT\", geo)) %>% filter(nchar(geo) == 4, ) %>% distinct(geo, .keep_all = T) %>% nuts_classify(nuts_code = \"geo\", data = .) nuts_get_data(man_deit) %>% group_by(country, from_version) %>% tally() ## # A tibble: 5 × 3 ## # Groups: country [3] ## country from_version n ## ## 1 Germany 2006 38 ## 2 Germany 2021 3 ## 3 Italy 2006 9 ## 4 Italy 2021 21 ## 5 NA NA 1 man_deit_converted <- nuts_convert_version( data = man_deit, to_version = 2021, variables = c(\"values\" = \"relative\"), multiple_versions = \"most_frequent\" ) man_deit_converted %>% group_by(country, to_version) %>% tally() ## # A tibble: 2 × 3 ## # Groups: country [2] ## country to_version n ## ## 1 Germany 2021 38 ## 2 Italy 2021 21"},{"path":"https://aaoritz.github.io/nuts/articles/nuts.html","id":"method","dir":"Articles","previous_headings":"","what":"Spatial interpolation in detail","title":"nuts: Convert European Regional Data in R","text":"section describes spatial interpolation procedure. first cover logic conversion tables explain methods used package converting versions levels.","code":""},{"path":"https://aaoritz.github.io/nuts/articles/nuts.html","id":"changes-in-administrative-boundaries","dir":"Articles","previous_headings":"Spatial interpolation in detail","what":"Changes in administrative boundaries","title":"nuts: Convert European Regional Data in R","text":", Norwegian NUTS-2 regions versions 2016 2021 shown. regions apart Norway’s Northern region reorganized period. Norwegian NUTS-2 regions boundary changes; Sources: Shapefiles EUROSTAT; Created using sf package. changes two versions can summarized follows: Boundary changes regions continued NUTS codes NO02 ceases small area new NO08 NO06 makes small area gains NO05 Changes regions discontinued NUTS codes NO01 absorbed NO08 NO03 split NO08 NO09 NO04 divides NO0A NO09 NO05 largely becomes new NO0A, gives small area NO06","code":""},{"path":"https://aaoritz.github.io/nuts/articles/nuts.html","id":"spatial-interpolation-and-conversion-tables","dir":"Articles","previous_headings":"Spatial interpolation in detail","what":"Spatial interpolation and conversion tables","title":"nuts: Convert European Regional Data in R","text":"keep track changes, nuts package uses regional flows different NUTS versions. package ships conversion table can called data(cross_walks) based data provided JRC. documents boundary changes NUTS regions. Norway going version 2016 2021, table looks follows: addition tracing evolution NUTS codes, table contains flows area, population artificial surfaces regions versions. flows computed JRC granular [100m x 100m] geographic data. ggalluvial plot visualizes flows area size NUTS-2 regions mapped . Alluvial plot illustrating area size flows; Created using ggalluvial package. illustrate main idea, map showcases population densities across NUTS-2 regions. population uniformly distributed across space, weighting regions dependent area size comes strong assumptions. instance, region NO01 version 2016, contains city Oslo, makes relatively modest geographical contribution new region NO08, significantly bolsters population latter. Assuming variable converted correlated population across space, conversion can thus refined using population weights account flows different versions. Spatial distribution population boundary changes; Sources: Shapefiles population raster EUROSTAT; Created using sf terra packages.","code":""},{"path":"https://aaoritz.github.io/nuts/articles/nuts.html","id":"conversion-methods","dir":"Articles","previous_headings":"Spatial interpolation in detail","what":"Conversion methods","title":"nuts: Convert European Regional Data in R","text":"following subsections describe method used convert absolute relative values versions levels.","code":""},{"path":"https://aaoritz.github.io/nuts/articles/nuts.html","id":"conversion-of-absolute-values-between-versions","dir":"Articles","previous_headings":"Spatial interpolation in detail > Conversion methods","what":"Conversion of absolute values between versions","title":"nuts: Convert European Regional Data in R","text":"example, transform absolute values, number patent applications (NR) Norway, version 2016 2021, utilizing spatial interpolation based population distribution 2018. conversion employs cross_walks table, includes population flow data (expressed thousands) two NUTS-2 regions source version target version. function joins variable interest, NR, varies across departing NUTS-2 codes (from_code). function initially calculates weight (w) equal population flow’s share total population departing region version 2016 (from_code): obtain number patent applications desired 2021 version, function summarizes data new NUTS regions version 2021 (to_code) taking population-weighted sum flows.","code":""},{"path":"https://aaoritz.github.io/nuts/articles/nuts.html","id":"conversion-of-relative-values-between-versions","dir":"Articles","previous_headings":"Spatial interpolation in detail > Conversion methods","what":"Conversion of relative values between versions","title":"nuts: Convert European Regional Data in R","text":"convert relative values, number patent applications per 1000 inhabitants, nuts_convert_version() departs conversion table seen . focus variable P_MHAB, patent applications per one million inhabitants. function summarizes relative values computing weighted average respect 2018 population flows.","code":""},{"path":"https://aaoritz.github.io/nuts/articles/nuts.html","id":"conversion-of-absolute-values-between-nuts-levels","dir":"Articles","previous_headings":"Spatial interpolation in detail > Conversion methods","what":"Conversion of absolute values between NUTS levels","title":"nuts: Convert European Regional Data in R","text":"function nuts_aggregate() aggregates lower higher order levels, e.g. NUTS-3 NUTS-2. Since higher order regions perfectly split lower order regions NUTS system, function takes simply sum values case absolute variables.","code":""},{"path":"https://aaoritz.github.io/nuts/articles/nuts.html","id":"conversion-of-relative-values-between-nuts-levels","dir":"Articles","previous_headings":"Spatial interpolation in detail > Conversion methods","what":"Conversion of relative values between NUTS levels","title":"nuts: Convert European Regional Data in R","text":"Relative values aggregated nuts_aggregate() computing weighted mean lower order regional levels. convert, example, number patent applications per one million inhabitants NUTS-3 NUTS-2, function adds population size 2018. number patent applications NUTS-2 level computed weighted average using NUTS-3 population numbers.","code":""},{"path":"https://aaoritz.github.io/nuts/articles/nuts.html","id":"citation","dir":"Articles","previous_headings":"","what":"Citation","title":"nuts: Convert European Regional Data in R","text":"Please support development open science citing JRC us work. Joint Research Centre (2022) NUTS converter. https://urban.jrc.ec.europa.eu/tools/nuts-converter Hennicke M, Krause W (2024). nuts: Convert European Regional Data. R package version 0.0.0.9000, https://AAoritz.github.io/nuts/ Bibtex Users:","code":"@Manual{, title = {NUTS converter}, author = {Joint Research Centre}, year = {2022}, url = {https://urban.jrc.ec.europa.eu/tools/nuts-converter}, } @Manual{, title = {nuts: Convert European Regional Data}, author = {Moritz Hennicke and Werner Krause}, year = {2024}, note = {R package version 0.0.0.9000}, url = {https://AAoritz.github.io/nuts/}, }"},{"path":"https://aaoritz.github.io/nuts/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Moritz Hennicke. Author, maintainer. Werner Krause. Author.","code":""},{"path":"https://aaoritz.github.io/nuts/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Hennicke M, Krause W (2024). nuts: Convert European Regional Data. R package version 0.0.0.9000, https://AAoritz.github.io/nuts/.","code":"@Manual{, title = {nuts: Convert European Regional Data}, author = {Moritz Hennicke and Werner Krause}, year = {2024}, note = {R package version 0.0.0.9000}, url = {https://AAoritz.github.io/nuts/}, }"},{"path":"https://aaoritz.github.io/nuts/index.html","id":"nuts-","dir":"","previous_headings":"","what":"Convert European Regional Data in R","title":"Convert European Regional Data in R","text":"Changing administrative regional boundaries time complicates construction consistent regional panel data. nuts package can transform European regional data identified NUTS codes different versions subdivision levels aim harmonize link data sets. package’s main task convert data NUTS versions use: 2006, 2010, 2013, 2016 2021. conversions can performed direction based spatial interpolation using five different weights (regional area square kilometers, 2011 2018 population size, 2012 2018 built-area). weights based conversion tables provided Joint Research Center (JRC) European Commission (EC) used online converter. nuts package permits conversion offline additional advantages conversion within groups, enabling conversion datasets multiple NUTS versions efficiently.","code":""},{"path":"https://aaoritz.github.io/nuts/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Convert European Regional Data in R","text":"can install recent development version Github:","code":"pak::pak(\"AAoritz/nuts\")"},{"path":"https://aaoritz.github.io/nuts/index.html","id":"usage","dir":"","previous_headings":"","what":"Usage","title":"Convert European Regional Data in R","text":"Check website example usage details.","code":""},{"path":"https://aaoritz.github.io/nuts/index.html","id":"verbosity-control","dir":"","previous_headings":"","what":"Verbosity Control","title":"Convert European Regional Data in R","text":"Console messages can controlled rlang::local_options(nuts.verbose = \"quiet\") silence messages setting nuts.verbose = \"verbose\" switch messages back .","code":""},{"path":"https://aaoritz.github.io/nuts/index.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Convert European Regional Data in R","text":"Please support development open science data citing JRC us work: Joint Research Centre (2022) NUTS converter. https://urban.jrc.ec.europa.eu/tools/nuts-converter Hennicke M, Krause W (2024). nuts: Convert European Regional Data. R package version 0.0.0.9000, https://AAoritz.github.io/nuts/. Bibtex Users:","code":"@Manual{, title = {NUTS converter}, author = {Joint Research Centre}, year = {2022}, url = {https://urban.jrc.ec.europa.eu/tools/nuts-converter}, } @Manual{, title = {nuts: Convert European Regional Data}, author = {Moritz Hennicke and Werner Krause}, year = {2024}, note = {R package version 0.0.0.9000}, url = {https://AAoritz.github.io/nuts/}, }"},{"path":"https://aaoritz.github.io/nuts/reference/all_nuts_codes.html","id":null,"dir":"Reference","previous_headings":"","what":"List of all NUTS codes and classifications — all_nuts_codes","title":"List of all NUTS codes and classifications — all_nuts_codes","text":"data frame stores NUTS codes hierarchical levels 1, 2 3 NUTS classification versions 2006, 2010, 2013, 2016 2021.","code":""},{"path":"https://aaoritz.github.io/nuts/reference/all_nuts_codes.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"List of all NUTS codes and classifications — all_nuts_codes","text":"","code":"all_nuts_codes"},{"path":[]},{"path":"https://aaoritz.github.io/nuts/reference/all_nuts_codes.html","id":"all-nuts-codes","dir":"Reference","previous_headings":"","what":"all_nuts_codes","title":"List of all NUTS codes and classifications — all_nuts_codes","text":"data frame 8,896 rows 2 columns: code NUTS code version NUTS versions country Country name","code":""},{"path":"https://aaoritz.github.io/nuts/reference/all_nuts_codes.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"List of all NUTS codes and classifications — all_nuts_codes","text":"https://urban.jrc.ec.europa.eu/nutsconverter/#/","code":""},{"path":"https://aaoritz.github.io/nuts/reference/cross_walks.html","id":null,"dir":"Reference","previous_headings":"","what":"Conversion table provided by the Joint Research Center of the European Commission — cross_walks","title":"Conversion table provided by the Joint Research Center of the European Commission — cross_walks","text":"table contains population, area surface flows two NUTS regions different NUTS code classifications. NUTS regions 1st, 2nd 3rd level. NUTS versions 2006, 2010, 2013, 2016 2021.","code":""},{"path":"https://aaoritz.github.io/nuts/reference/cross_walks.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Conversion table provided by the Joint Research Center of the European Commission — cross_walks","text":"","code":"cross_walks"},{"path":[]},{"path":"https://aaoritz.github.io/nuts/reference/cross_walks.html","id":"cross-walks","dir":"Reference","previous_headings":"","what":"cross_walks","title":"Conversion table provided by the Joint Research Center of the European Commission — cross_walks","text":"data frame 47,340 rows 9 columns: from_code Departing NUTS code to_code Desired NUTS code from_version Departing NUTS version to_version Desired NUTS version level NUTS division level country Country name areaKm Area size flow pop18 2018 population flow pop11 2011 population flow artif_surf18 2018 artificial surfaces flow artif_surf12 2012 artificial surfaces flow","code":""},{"path":"https://aaoritz.github.io/nuts/reference/cross_walks.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Conversion table provided by the Joint Research Center of the European Commission — cross_walks","text":"https://urban.jrc.ec.europa.eu/nutsconverter/#/","code":""},{"path":"https://aaoritz.github.io/nuts/reference/manure.html","id":null,"dir":"Reference","previous_headings":"","what":"Manure storage facilities by NUTS 3 regions from Eurostat (aei_fm_ms) — manure","title":"Manure storage facilities by NUTS 3 regions from Eurostat (aei_fm_ms) — manure","text":"data frame contains number different manure storage facilities Farm Structure Survey (former) EU member states, Iceland, Norway, Switzerland Montenegro NUTS 3 level. Please see link indicated information.","code":""},{"path":"https://aaoritz.github.io/nuts/reference/manure.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Manure storage facilities by NUTS 3 regions from Eurostat (aei_fm_ms) — manure","text":"","code":"manure"},{"path":[]},{"path":"https://aaoritz.github.io/nuts/reference/manure.html","id":"manure","dir":"Reference","previous_headings":"","what":"manure","title":"Manure storage facilities by NUTS 3 regions from Eurostat (aei_fm_ms) — manure","text":"data frame 17,151 rows 4 columns: indic_ag 9 indicators: manure storage facilities, solid dung, liquid manure slurry, slurry: tank, slurry: lagoon; covered facilities either dung, liquid manure, slurry geo NUTS 1, 2, 3 National level time Years 2000, 2003 2010 values Number","code":""},{"path":"https://aaoritz.github.io/nuts/reference/manure.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Manure storage facilities by NUTS 3 regions from Eurostat (aei_fm_ms) — manure","text":"https://ec.europa.eu/eurostat/databrowser/view/aei_fm_ms/default/table?lang=en","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts-package.html","id":null,"dir":"Reference","previous_headings":"","what":"nuts: 'nuts': Convert European Regional Data — nuts-package","title":"nuts: 'nuts': Convert European Regional Data — nuts-package","text":"Motivated changing administrative boundaries time, 'nuts' package can convert European regional data NUTS codes versions (2006, 2010, 2013, 2016 2021) levels (NUTS 1, NUTS 2 NUTS 3). package uses spatial interpolation based granular (100mx100m) population land use data provided European Commission's Joint Research Center.","code":""},{"path":[]},{"path":"https://aaoritz.github.io/nuts/reference/nuts-package.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"nuts: 'nuts': Convert European Regional Data — nuts-package","text":"Maintainer: Moritz Hennicke AAoritz@posteo.de (ORCID) Authors: Werner Krause werner.krause@uni-potsdam.de (ORCID)","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_aggregate.html","id":null,"dir":"Reference","previous_headings":"","what":"Aggregate to higher order NUTS levels — nuts_aggregate","title":"Aggregate to higher order NUTS levels — nuts_aggregate","text":"nuts_aggregate() transforms regional NUTS data NUTS levels.","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_aggregate.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Aggregate to higher order NUTS levels — nuts_aggregate","text":"","code":"nuts_aggregate( data, to_level, variables, weight = NULL, missing_rm = FALSE, multiple_versions = c(\"error\", \"most_frequent\") )"},{"path":"https://aaoritz.github.io/nuts/reference/nuts_aggregate.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Aggregate to higher order NUTS levels — nuts_aggregate","text":"data nuts.classified object returned nuts_classify(). to_level Number corresponding desired NUTS level aggregated : 1 2. variables Named character specifying variable names variable type ('absolute' 'relative'), e.g. c('var_name' = 'absolute'). weight String name weight used conversion. Can area size 'areaKm' (default), population 2011 'pop11' 2018 'pop18', artificial surfaces 2012 'artif_surf12' 2018 'artif_surf18'. missing_rm Boolean FALSE default. TRUE removes regional flows depart missing NUTS codes. multiple_versions default equal 'error', providing multiple NUTS versions within groups. set 'most_frequent' data converted using best-matching NUTS version.","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_aggregate.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Aggregate to higher order NUTS levels — nuts_aggregate","text":"tibble containing NUTS codes, aggregated variable values, possibly grouping variables.","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_aggregate.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Aggregate to higher order NUTS levels — nuts_aggregate","text":"Console messages can controlled rlang::local_options(nuts.verbose = \"quiet\") silence messages nuts.verbose = \"verbose\" switch messages back .","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_aggregate.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Aggregate to higher order NUTS levels — nuts_aggregate","text":"","code":"library(dplyr) #> #> Attaching package: ‘dplyr’ #> The following objects are masked from ‘package:stats’: #> #> filter, lag #> The following objects are masked from ‘package:base’: #> #> intersect, setdiff, setequal, union # Load EUROSTAT data of manure storage deposits data(manure) # Data varies at the NUTS level x indicator x year x country x NUTS code level head(manure) #> # A tibble: 6 × 4 #> indic_ag geo time values #> #> 1 I07A1_EQ_Y AT 2010 97401 #> 2 I07A1_EQ_Y AT1 2010 21388 #> 3 I07A1_EQ_Y AT11 2010 2110 #> 4 I07A1_EQ_Y AT111 2010 270 #> 5 I07A1_EQ_Y AT112 2010 455 #> 6 I07A1_EQ_Y AT113 2010 1385 # Aggregate from NUTS 3 to 2 by indicator x year manure %>% filter(nchar(geo) == 5) %>% nuts_classify(nuts_code = \"geo\", group_vars = c('indic_ag','time')) %>% # Group vars are automatically passed on nuts_aggregate(to_level = 2, variables = c('values'= 'absolute'), weight = 'pop18') #> # A tibble: 4,814 × 5 #> to_code country indic_ag time values #> #> 1 AT11 Austria I07A1_EQ_Y 2010 2110 #> 2 AT11 Austria I07A1_EQ_YC 2010 337 #> 3 AT11 Austria I07A2_EQ_Y 2010 802 #> 4 AT11 Austria I07A2_EQ_YC 2010 756 #> 5 AT11 Austria I07A31_EQ_Y 2010 278 #> 6 AT11 Austria I07A32_EQ_Y 2010 31 #> 7 AT11 Austria I07A3_EQ_YC 2010 261 #> 8 AT11 Austria I07A_EQ_Y 2010 2180 #> 9 AT12 Austria I07A1_EQ_Y 2010 19250 #> 10 AT12 Austria I07A1_EQ_YC 2010 1853 #> # ℹ 4,804 more rows"},{"path":"https://aaoritz.github.io/nuts/reference/nuts_classify.html","id":null,"dir":"Reference","previous_headings":"","what":"Classify version of NUTS codes — nuts_classify","title":"Classify version of NUTS codes — nuts_classify","text":"nuts_classify() can identify NUTS version year level variable containing NUTS codes.","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_classify.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Classify version of NUTS codes — nuts_classify","text":"","code":"nuts_classify( data, nuts_code, group_vars = NULL, ties = c(\"most_recent\", \"oldest\") )"},{"path":"https://aaoritz.github.io/nuts/reference/nuts_classify.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Classify version of NUTS codes — nuts_classify","text":"data data frame tibble contains variable NUTS 1, 2 3 codes possibly variables. NUTS codes must level need unique, unless additional grouping variables specified. duplicate NUTS codes within groups allowed. nuts_code Variable name containing NUTS codes group_vars Variable name(s) classification within groups. nuts_classify() always computes overlap within country. Hence, country variables specified. NULL default. ties Picks 'most_recent' 'oldest' version overlap identical across multiple NUTS versions. 'most_recent' default.","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_classify.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Classify version of NUTS codes — nuts_classify","text":"list three tibbles. first tibble contains original data classified NUTS version, level, country. second tibble lists group-specific overlap NUTS version. third tibble shows missing NUTS codes group. output can passed nuts_convert_version() convert data across NUTS versions nuts_aggregate() aggregate across NUTS levels.","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_classify.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Classify version of NUTS codes — nuts_classify","text":"Console messages can controlled rlang::local_options(nuts.verbose = \"quiet\") silence messages nuts.verbose = \"verbose\" switch messages back .","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_classify.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Classify version of NUTS codes — nuts_classify","text":"","code":"library(dplyr) # Load EUROSTAT data of manure storage deposits data(manure) # Data varies at the NUTS level x indicator x year x country x NUTS code level head(manure) #> # A tibble: 6 × 4 #> indic_ag geo time values #> #> 1 I07A1_EQ_Y AT 2010 97401 #> 2 I07A1_EQ_Y AT1 2010 21388 #> 3 I07A1_EQ_Y AT11 2010 2110 #> 4 I07A1_EQ_Y AT111 2010 270 #> 5 I07A1_EQ_Y AT112 2010 455 #> 6 I07A1_EQ_Y AT113 2010 1385 # Classify version of NUTS 2 codes in Germany manure %>% filter(nchar(geo) == 4) %>% filter(indic_ag == 'I07A_EQ_Y') %>% filter(grepl('^DE', geo)) %>% filter(time == 2003) %>% select(-indic_ag, -time) %>% # Data varies at the NUTS code level nuts_classify(nuts_code = 'geo') #> $data #> # A tibble: 36 × 5 #> from_code from_version from_level country values #> #> 1 DE11 2006 2 Germany 11320 #> 2 DE12 2006 2 Germany 3710 #> 3 DE13 2006 2 Germany 9710 #> 4 DE14 2006 2 Germany 11220 #> 5 DE21 2006 2 Germany 22760 #> 6 DE22 2006 2 Germany 16390 #> 7 DE23 2006 2 Germany 12500 #> 8 DE24 2006 2 Germany 8440 #> 9 DE25 2006 2 Germany 10380 #> 10 DE26 2006 2 Germany 6150 #> # ℹ 26 more rows #> #> $versions_data #> # A tibble: 6 × 3 #> from_version country overlap_perc #> #> 1 2006 Germany 100 #> 2 2021 Germany 88.6 #> 3 2016 Germany 88.6 #> 4 2013 Germany 88.6 #> 5 2010 Germany 88.6 #> 6 NA NA NA #> #> $missing_data #> # A tibble: 4 × 4 #> from_code from_version from_level country #> #> 1 DE30 2006 2 Germany #> 2 DE50 2006 2 Germany #> 3 DE60 2006 2 Germany #> 4 DEC0 2006 2 Germany #> #> attr(,\"groups\") #> [1] \"country\" #> attr(,\"class\") #> [1] \"nuts.classified\" \"list\" # Classify version of NUTS 3 codes within country and year manure %>% filter(nchar(geo) == 5) %>% filter(indic_ag == 'I07A_EQ_Y') %>% select(-indic_ag) %>% # Data varies at the year x country x NUTS code level. The country grouping # is always used by default. nuts_classify(nuts_code = 'geo', group_vars = 'time') #> $data #> # A tibble: 1,902 × 6 #> from_code from_version from_level country time values #> #> 1 AT111 2021 3 Austria 2010 276 #> 2 AT112 2021 3 Austria 2010 482 #> 3 AT113 2021 3 Austria 2010 1422 #> 4 AT121 2021 3 Austria 2010 6889 #> 5 AT122 2021 3 Austria 2010 3133 #> 6 AT123 2021 3 Austria 2010 2027 #> 7 AT124 2021 3 Austria 2010 5870 #> 8 AT125 2021 3 Austria 2010 905 #> 9 AT126 2021 3 Austria 2010 1103 #> 10 AT127 2021 3 Austria 2010 506 #> # ℹ 1,892 more rows #> #> $versions_data #> # A tibble: 312 × 4 #> from_version country time overlap_perc #> #> 1 2021 Austria 2010 100 #> 2 2016 Austria 2010 100 #> 3 2013 Austria 2010 100 #> 4 2010 Austria 2010 100 #> 5 2006 Austria 2010 100 #> 6 2016 Belgium 2000 100 #> 7 2013 Belgium 2000 100 #> 8 2010 Belgium 2000 100 #> 9 2006 Belgium 2000 100 #> 10 2021 Belgium 2000 81.8 #> # ℹ 302 more rows #> #> $missing_data #> # A tibble: 324 × 5 #> from_code from_version from_level country time #> #> 1 CZ010 2021 3 Czechia 2003 #> 2 DK011 2021 3 Denmark 2003 #> 3 DK012 2021 3 Denmark 2003 #> 4 EE001 2016 3 Estonia 2003 #> 5 EE007 2016 3 Estonia 2003 #> 6 EL111 2010 3 Greece 2003 #> 7 EL112 2010 3 Greece 2003 #> 8 EL113 2010 3 Greece 2003 #> 9 EL114 2010 3 Greece 2003 #> 10 EL115 2010 3 Greece 2003 #> # ℹ 314 more rows #> #> attr(,\"groups\") #> [1] \"country\" \"time\" #> attr(,\"class\") #> [1] \"nuts.classified\" \"list\""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_convert_version.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert between NUTS versions — nuts_convert_version","title":"Convert between NUTS versions — nuts_convert_version","text":"nuts_convert_version() transforms regional NUTS data NUTS versions.","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_convert_version.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert between NUTS versions — nuts_convert_version","text":"","code":"nuts_convert_version( data, to_version, variables, weight = NULL, missing_rm = FALSE, multiple_versions = c(\"error\", \"most_frequent\") )"},{"path":"https://aaoritz.github.io/nuts/reference/nuts_convert_version.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert between NUTS versions — nuts_convert_version","text":"data nuts.classified object returned nuts_classify(). to_version String desired NUTS version function convert . Possible versions: '2006', '2010', '2013', '2016' '2021' variables Named character specifying variable names variable type ('absolute' 'relative') e.g. c('var_name' = 'absolute') weight String name weight used conversion. Can area size 'areaKm' (default), population 2011 'pop11' 2018 'pop18', artificial surfaces 2012 'artif_surf12' 2018 'artif_surf18'. missing_rm Boolean FALSE default. TRUE removes regional flows depart missing NUTS codes. multiple_versions default equal 'error', providing multiple NUTS versions within groups. set 'most_frequent' data converted using best-matching NUTS version.","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_convert_version.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert between NUTS versions — nuts_convert_version","text":"tibble containing NUTS codes, converted variable values, possibly grouping variables.","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_convert_version.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Convert between NUTS versions — nuts_convert_version","text":"Console messages can controlled rlang::local_options(nuts.verbose = \"quiet\") silence messages nuts.verbose = \"verbose\" switch messages back .","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_convert_version.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Convert between NUTS versions — nuts_convert_version","text":"","code":"library(dplyr) # Load EUROSTAT data of manure storage deposits data(manure) # Data varies at the NUTS level x indicator x year x country x NUTS code level head(manure) #> # A tibble: 6 × 4 #> indic_ag geo time values #> #> 1 I07A1_EQ_Y AT 2010 97401 #> 2 I07A1_EQ_Y AT1 2010 21388 #> 3 I07A1_EQ_Y AT11 2010 2110 #> 4 I07A1_EQ_Y AT111 2010 270 #> 5 I07A1_EQ_Y AT112 2010 455 #> 6 I07A1_EQ_Y AT113 2010 1385 # Convert NUTS 2 codes in Germany from 2006 to 2021 version manure %>% filter(nchar(geo) == 4) %>% filter(indic_ag == 'I07A_EQ_Y') %>% filter(grepl('^DE', geo)) %>% filter(time == 2003) %>% select(-indic_ag, -time) %>% # Data now only varies at the NUTS code level nuts_classify(nuts_code = \"geo\") %>% nuts_convert_version(to_version = '2021', weight = 'pop18', variables = c('values' = 'absolute')) #> # A tibble: 38 × 4 #> to_code to_version country values #> #> 1 DE11 2021 Germany 11320 #> 2 DE12 2021 Germany 3710 #> 3 DE13 2021 Germany 9710 #> 4 DE14 2021 Germany 11220 #> 5 DE21 2021 Germany 22760 #> 6 DE22 2021 Germany 16390 #> 7 DE23 2021 Germany 12500 #> 8 DE24 2021 Germany 8440 #> 9 DE25 2021 Germany 10380 #> 10 DE26 2021 Germany 6150 #> # ℹ 28 more rows # Convert NUTS 3 codes by country x year, classifying version first manure %>% filter(nchar(geo) == 5) %>% filter(indic_ag == 'I07A_EQ_Y') %>% select(-indic_ag) %>% # Data now varies at the year x NUTS code level nuts_classify(nuts_code = 'geo', group_vars = c('time')) %>% nuts_convert_version(to_version = '2021', weight = 'pop18', variables = c('values' = 'absolute')) #> # A tibble: 2,296 × 5 #> to_code to_version country time values #> #> 1 AT111 2021 Austria 2010 276 #> 2 AT112 2021 Austria 2010 482 #> 3 AT113 2021 Austria 2010 1422 #> 4 AT121 2021 Austria 2010 6889 #> 5 AT122 2021 Austria 2010 3133 #> 6 AT123 2021 Austria 2010 2027 #> 7 AT124 2021 Austria 2010 5870 #> 8 AT125 2021 Austria 2010 905 #> 9 AT126 2021 Austria 2010 1103 #> 10 AT127 2021 Austria 2010 506 #> # ℹ 2,286 more rows"},{"path":"https://aaoritz.github.io/nuts/reference/nuts_get_data.html","id":null,"dir":"Reference","previous_headings":"","what":"Return classified NUTS data — nuts_get_data","title":"Return classified NUTS data — nuts_get_data","text":"nuts_get_data() returns classified data running nuts_classify().","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_get_data.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return classified NUTS data — nuts_get_data","text":"","code":"nuts_get_data(data)"},{"path":"https://aaoritz.github.io/nuts/reference/nuts_get_data.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return classified NUTS data — nuts_get_data","text":"data nuts.classified object returned nuts_classify().","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_get_data.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return classified NUTS data — nuts_get_data","text":"tibble containing original data classified NUTS version, level, country.","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_get_data.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Return classified NUTS data — nuts_get_data","text":"Console messages can controlled rlang::local_options(nuts.verbose = \"quiet\") silence messages nuts.verbose = \"verbose\" switch messages back .","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_get_data.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Return classified NUTS data — nuts_get_data","text":"","code":"library(dplyr) # Load EUROSTAT data of manure storage deposits data(manure) # Classify version of NUTS 2 codes in Germany classified <- manure %>% filter(nchar(geo) == 4) %>% filter(indic_ag == 'I07A_EQ_Y') %>% filter(grepl('^DE', geo)) %>% filter(time == 2003) %>% select(-indic_ag, -time) %>% # Data varies at the NUTS code level nuts_classify(nuts_code = 'geo') nuts_get_data(classified) #> # A tibble: 36 × 5 #> from_code from_version from_level country values #> #> 1 DE11 2006 2 Germany 11320 #> 2 DE12 2006 2 Germany 3710 #> 3 DE13 2006 2 Germany 9710 #> 4 DE14 2006 2 Germany 11220 #> 5 DE21 2006 2 Germany 22760 #> 6 DE22 2006 2 Germany 16390 #> 7 DE23 2006 2 Germany 12500 #> 8 DE24 2006 2 Germany 8440 #> 9 DE25 2006 2 Germany 10380 #> 10 DE26 2006 2 Germany 6150 #> # ℹ 26 more rows"},{"path":"https://aaoritz.github.io/nuts/reference/nuts_get_missing.html","id":null,"dir":"Reference","previous_headings":"","what":"Return missing NUTS codes in classified NUTS data — nuts_get_missing","title":"Return missing NUTS codes in classified NUTS data — nuts_get_missing","text":"nuts_get_missing() returns classified data running nuts_classify().","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_get_missing.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return missing NUTS codes in classified NUTS data — nuts_get_missing","text":"","code":"nuts_get_missing(data)"},{"path":"https://aaoritz.github.io/nuts/reference/nuts_get_missing.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return missing NUTS codes in classified NUTS data — nuts_get_missing","text":"data nuts.classified object returned nuts_classify().","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_get_missing.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return missing NUTS codes in classified NUTS data — nuts_get_missing","text":"tibble listing missing NUTS codes group.","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_get_missing.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Return missing NUTS codes in classified NUTS data — nuts_get_missing","text":"Console messages can controlled rlang::local_options(nuts.verbose = \"quiet\") silence messages nuts.verbose = \"verbose\" switch messages back .","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_get_missing.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Return missing NUTS codes in classified NUTS data — nuts_get_missing","text":"","code":"library(dplyr) # Load EUROSTAT data of manure storage deposits data(manure) # Classify version of NUTS 2 codes in Germany classified <- manure %>% filter(nchar(geo) == 4) %>% filter(indic_ag == 'I07A_EQ_Y') %>% filter(grepl('^DE', geo)) %>% filter(time == 2003) %>% select(-indic_ag, -time) %>% # Data varies at the NUTS code level nuts_classify(nuts_code = 'geo') nuts_get_missing(classified) #> # A tibble: 4 × 4 #> from_code from_version from_level country #> #> 1 DE30 2006 2 Germany #> 2 DE50 2006 2 Germany #> 3 DE60 2006 2 Germany #> 4 DEC0 2006 2 Germany"},{"path":"https://aaoritz.github.io/nuts/reference/nuts_get_version.html","id":null,"dir":"Reference","previous_headings":"","what":"Return version overlap of classified NUTS data — nuts_get_version","title":"Return version overlap of classified NUTS data — nuts_get_version","text":"nuts_get_version() returns classified data running nuts_classify().","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_get_version.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return version overlap of classified NUTS data — nuts_get_version","text":"","code":"nuts_get_version(data)"},{"path":"https://aaoritz.github.io/nuts/reference/nuts_get_version.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return version overlap of classified NUTS data — nuts_get_version","text":"data nuts.classified object returned nuts_classify().","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_get_version.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return version overlap of classified NUTS data — nuts_get_version","text":"tibble lists group-specific overlap NUTS version.","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_get_version.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Return version overlap of classified NUTS data — nuts_get_version","text":"Console messages can controlled rlang::local_options(nuts.verbose = \"quiet\") silence messages nuts.verbose = \"verbose\" switch messages back .","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_get_version.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Return version overlap of classified NUTS data — nuts_get_version","text":"","code":"library(dplyr) # Load EUROSTAT data of manure storage deposits data(manure) # Classify version of NUTS 2 codes in Germany classified <- manure %>% filter(nchar(geo) == 4) %>% filter(indic_ag == 'I07A_EQ_Y') %>% filter(grepl('^DE', geo)) %>% filter(time == 2003) %>% select(-indic_ag, -time) %>% # Data varies at the NUTS code level nuts_classify(nuts_code = 'geo') nuts_get_version(classified) #> # A tibble: 6 × 3 #> from_version country overlap_perc #> #> 1 2006 Germany 100 #> 2 2021 Germany 88.6 #> 3 2016 Germany 88.6 #> 4 2013 Germany 88.6 #> 5 2010 Germany 88.6 #> 6 NA NA NA"},{"path":"https://aaoritz.github.io/nuts/reference/nuts_test_multiple_versions.html","id":null,"dir":"Reference","previous_headings":"","what":"Helper function to test for multiple versions — nuts_test_multiple_versions","title":"Helper function to test for multiple versions — nuts_test_multiple_versions","text":"nuts_test_multiple_versions called either nuts_convert_version nuts_aggregate selects frequent version within groups throw error.","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_test_multiple_versions.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Helper function to test for multiple versions — nuts_test_multiple_versions","text":"","code":"nuts_test_multiple_versions(group_vars, multiple_versions, data_versions, data)"},{"path":"https://aaoritz.github.io/nuts/reference/nuts_test_multiple_versions.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Helper function to test for multiple versions — nuts_test_multiple_versions","text":"group_vars Variable name(s) classification within groups. Always computes overlap within country. NULL default. multiple_versions default equal 'error', providing multiple NUTS versions within groups. data_versions Data versions data nuts.classified object returned nuts_classify().","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_test_multiple_versions.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Helper function to test for multiple versions — nuts_test_multiple_versions","text":"tibble containing NUTS codes, potential number rows dropped message results test.","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_test_multiple_versions.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Helper function to test for multiple versions — nuts_test_multiple_versions","text":"","code":"library(dplyr) df <- manure %>% filter(nchar(geo) == 5) %>% select(geo, indic_ag, values) %>% distinct(geo, .keep_all = T) %>% nuts_classify(nuts_code = \"geo\", group_vars = \"indic_ag\", data = .) nuts_test_multiple_versions(group_vars = \"indic_ag\", multiple_versions = \"most_frequent\", data_versions = df$versions_data, data = df$data) #> $data #> # A tibble: 282 × 8 #> from_code from_version from_level country.x indic_ag values country.y #> #> 1 AT111 2021 3 Austria I07A1_EQ_Y 270 Austria #> 2 AT112 2021 3 Austria I07A1_EQ_Y 455 Austria #> 3 AT113 2021 3 Austria I07A1_EQ_Y 1385 Austria #> 4 AT121 2021 3 Austria I07A1_EQ_Y 6485 Austria #> 5 AT122 2021 3 Austria I07A1_EQ_Y 2988 Austria #> 6 AT123 2021 3 Austria I07A1_EQ_Y 1799 Austria #> 7 AT124 2021 3 Austria I07A1_EQ_Y 5668 Austria #> 8 AT125 2021 3 Austria I07A1_EQ_Y 848 Austria #> 9 AT126 2021 3 Austria I07A1_EQ_Y 979 Austria #> 10 AT127 2021 3 Austria I07A1_EQ_Y 483 Austria #> # ℹ 272 more rows #> # ℹ 1 more variable: overlap_perc #> #> $n_rows_dropped #> [1] 739 #> #> $message_multiple_versions #> ! #> \"{.blue Choosing most frequent version within group and {.red dropping} {n_rows_dropped} row{?s}.}\" #>"},{"path":"https://aaoritz.github.io/nuts/reference/patents.html","id":null,"dir":"Reference","previous_headings":"","what":"Patent applications to the EPO by priority year by NUTS 3 regions (pat_ep_rtot) — patents","title":"Patent applications to the EPO by priority year by NUTS 3 regions (pat_ep_rtot) — patents","text":"data frame contains information patent applications European Patent Office year NUTS 3 regions.","code":""},{"path":"https://aaoritz.github.io/nuts/reference/patents.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Patent applications to the EPO by priority year by NUTS 3 regions (pat_ep_rtot) — patents","text":"","code":"patents"},{"path":[]},{"path":"https://aaoritz.github.io/nuts/reference/patents.html","id":"patents","dir":"Reference","previous_headings":"","what":"patents","title":"Patent applications to the EPO by priority year by NUTS 3 regions (pat_ep_rtot) — patents","text":"data frame 104,106 rows 4 columns: unit 4 indicators: Number, Nominal GDP billion euro, Per million habitants, Per million population labor force geo NUTS 1, 2, 3 National level time Years 2008, 2009, 2010, 2011 2012 values Values","code":""},{"path":"https://aaoritz.github.io/nuts/reference/patents.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Patent applications to the EPO by priority year by NUTS 3 regions (pat_ep_rtot) — patents","text":"https://ec.europa.eu/eurostat/databrowser/view/PAT_EP_RTOT/default/table","code":""},{"path":"https://aaoritz.github.io/nuts/news/index.html","id":"nuts-0009000","dir":"Changelog","previous_headings":"","what":"nuts 0.0.0.9000","title":"nuts 0.0.0.9000","text":"Development version launch","code":""}] +[{"path":"https://aaoritz.github.io/nuts/CONTRIBUTING.html","id":null,"dir":"","previous_headings":"","what":"Contributing to nuts","title":"Contributing to nuts","text":"outlines propose change nuts.","code":""},{"path":"https://aaoritz.github.io/nuts/CONTRIBUTING.html","id":"fixing-typos","dir":"","previous_headings":"","what":"Fixing typos","title":"Contributing to nuts","text":"can fix typos, spelling mistakes, grammatical errors documentation directly using GitHub web interface, long changes made source file. generally means ’ll need edit roxygen2 comments .R, .Rd file. can find .R file generates .Rd reading comment first line.","code":""},{"path":"https://aaoritz.github.io/nuts/CONTRIBUTING.html","id":"bigger-changes","dir":"","previous_headings":"","what":"Bigger changes","title":"Contributing to nuts","text":"want make bigger change, ’s good idea first file issue make sure someone team agrees ’s needed. ’ve found bug, please file issue illustrates bug minimal reprex (also help write unit test, needed).","code":""},{"path":"https://aaoritz.github.io/nuts/CONTRIBUTING.html","id":"pull-request-process","dir":"","previous_headings":"Bigger changes","what":"Pull request process","title":"Contributing to nuts","text":"Fork package clone onto computer. haven’t done , recommend using usethis::create_from_github(\"AAoritz/nuts\", fork = TRUE). Install development dependencies devtools::install_dev_deps(), make sure package passes R CMD check running devtools::check(). R CMD check doesn’t pass cleanly, ’s good idea ask help continuing. Create Git branch pull request (PR). recommend using usethis::pr_init(\"brief-description--change\"). Make changes, commit git, create PR running usethis::pr_push(), following prompts browser. title PR briefly describe change. body PR contain Fixes #issue-number. user-facing changes, add bullet top NEWS.md (.e. just first header). Follow style described https://style.tidyverse.org/news.html.","code":""},{"path":"https://aaoritz.github.io/nuts/CONTRIBUTING.html","id":"code-style","dir":"","previous_headings":"Bigger changes","what":"Code style","title":"Contributing to nuts","text":"use roxygen2, Markdown syntax, documentation. use testthat unit tests. Contributions test cases included easier accept.","code":""},{"path":"https://aaoritz.github.io/nuts/CONTRIBUTING.html","id":"code-of-conduct","dir":"","previous_headings":"","what":"Code of Conduct","title":"Contributing to nuts","text":"Please note package released Contributor Code Conduct. contributing project, agree abide terms.","code":""},{"path":"https://aaoritz.github.io/nuts/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2024 nuts authors Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"https://aaoritz.github.io/nuts/articles/nuts.html","id":"key-features","dir":"Articles","previous_headings":"","what":"Key Features","title":"nuts: Convert European Regional Data in R","text":"Efficient offline conversion European regional data. Conversion five NUTS versions: 2006, 2010, 2013, 2016, 2021. Conversion three regional levels: NUTS-1, NUTS-2, NUTS-3. Ability convert multiple NUTS versions e.g. NUTS versions differ across countries years. scenario common working data sourced EUROSTAT. (Dasymetric) Spatial interpolation based five weights (regional area size, 2011 2018 population size, 2012 2018 built-area) built granular [100m x 100m] geodata European Commission’s Joint Research Center (JRC).","code":""},{"path":"https://aaoritz.github.io/nuts/articles/nuts.html","id":"nuts-codes","dir":"Articles","previous_headings":"","what":"NUTS Codes","title":"nuts: Convert European Regional Data in R","text":"Nomenclature Territorial Units Statistics (NUTS) geocode standard referencing administrative divisions European countries. NUTS code starts two-letter combination indicating country.1 administrative subdivisions, levels, referred additional number capital letter (NUTS-1). second (NUTS-2) third (NUTS-3) subdivision level referred another digit . example, German district Northern Saxony (Nordsachsen) located within region Leipzig federate state Saxony. DED: Saxony DED5: Leipzig DED53: Northern Saxony Since administrative boundaries Europe change demographic, economic, political reasons, five different versions NUTS Nomenclature (2006, 2010, 2013, 2016, 2021). current version, effective 1 January 2021, lists 104 regions NUTS-1, 283 regions NUTS-2, 1 345 regions NUTS-3 level2.","code":""},{"path":"https://aaoritz.github.io/nuts/articles/nuts.html","id":"spatial-interpolation-in-a-nutshell","dir":"Articles","previous_headings":"NUTS Codes","what":"Spatial interpolation in a nutshell","title":"nuts: Convert European Regional Data in R","text":"administrative units restructured, regional data measured within old boundaries can converted new boundaries reasonable assumptions. main task package use (dasymetric) spatial interpolation accomplish . Let’s take example German state Saxony figures . , NUTS-2 regions Leipzig (DED3 → DED5) Chemnitz (DED1 → DED4) reorganized. interested number manure storage facilities 2003 provided EUROSTAT based 2006 NUTS version. part Leipzig reassigned Chemnitz (center plot), prompting us recalculate number storage facilities 2010 version (right plot). simple approach redistribute manure storage facilities proportional transferred area, assuming equal distribution manure storages across space. dasymetric approach, make use built-area, assuming manure deposits likely found close residential areas economic sites. example, Leipzig lost 7.7% (\\(\\frac{5574}{72360}\\)) built-area. re-calculate number manure storage facilities computing 7.7% Leipzig’s manure storages \\(\\frac{5574}{72360} * 700 = 54\\), subtracting Leipzig adding Chemnitz. See Section Spatial interpolation detail -depth description weighting procedure. Holdings Manure Storage Facilities; BU = Built-Area \\(m^{2}\\); Sources: Shapefiles data EUROSTAT; Created using sf package.","code":""},{"path":"https://aaoritz.github.io/nuts/articles/nuts.html","id":"usage","dir":"Articles","previous_headings":"","what":"Usage","title":"nuts: Convert European Regional Data in R","text":"package comes three main functions: nuts_classify() detects NUTS version(s) level(s) data set. output can directly fed two functions. nuts_convert_version() converts data desired NUTS version (2006, 2010, 2013, 2016, 2021). transformation works direction. nuts_aggregate() aggregates data upper-level NUTS code, .e., transforms NUTS-3 data NUTS-2 NUTS-1 level (vice versa).","code":""},{"path":"https://aaoritz.github.io/nuts/articles/nuts.html","id":"workflow","dir":"Articles","previous_headings":"Usage","what":"Workflow","title":"nuts: Convert European Regional Data in R","text":"conversion can conducted classifying NUTS version(s) level(s) data using function nuts_classify(). step ensures validity completeness NUTS codes proceeding conversion. Sequential workflow convert regional NUTS data","code":""},{"path":"https://aaoritz.github.io/nuts/articles/nuts.html","id":"identifying-nuts-version-and-level","dir":"Articles","previous_headings":"Usage","what":"Identifying NUTS version and level","title":"nuts: Convert European Regional Data in R","text":"nuts_classify() function’s main purpose find suitable NUTS version identify level data set. , see example using patent application data (per one million inhabitants) Norway 2012 NUTS-2 level. data provided EUROSTAT. function returns list three items. items can called directly output object (data$...) retrieved using three helper functions nuts_get_data(), nuts_get_version(), nuts_get_missing(). first item gives original data set augmented columns from_version, from_level, country, indicating NUTS version best suits data. functions package always group NUTS codes across country names automatically generated provided NUTS codes. , see data entries correspond 2016 NUTS version. second item provides overview share matching NUTS codes five existing NUTS versions. overlap computed within country possibly additional groups (provided via group_vars argument). third item gives NUTS codes missing across groups. missing codes might lead conversion errors , default, omitted conversion procedures. example, NUTS codes missing.","code":"# Load packages library(nuts) library(dplyr) library(stringr) # Loading and subsetting Eurostat data data(patents, package = \"nuts\") pat_n2 <- patents %>% filter(nchar(geo) == 4) # NUTS-2 values pat_n2_mhab_12_no <- pat_n2 %>% filter(unit == \"P_MHAB\") %>% # Patents per one million inhabitants filter(time == 2012) %>% # 2012 filter(str_detect(geo, \"^NO\")) %>% # Norway select(-unit) # Classifying the Data pat_classified <- nuts_classify( data = pat_n2_mhab_12_no, nuts_code = \"geo\" ) # pat_classified$data # Call list item directly or... nuts_get_data(pat_classified) # ...use helper function ## # A tibble: 7 × 6 ## from_code from_version from_level country time values ## ## 1 NO01 2016 2 Norway 2012 125. ## 2 NO02 2016 2 Norway 2012 13.2 ## 3 NO03 2016 2 Norway 2012 57.4 ## 4 NO04 2016 2 Norway 2012 110. ## 5 NO05 2016 2 Norway 2012 48.9 ## 6 NO06 2016 2 Norway 2012 145. ## 7 NO07 2016 2 Norway 2012 16.5 # pat_classified$versions_data # Call list item directly or... nuts_get_version(pat_classified) # ...use helper function ## # A tibble: 5 × 3 ## from_version country overlap_perc ## ## 1 2016 Norway 100 ## 2 2013 Norway 100 ## 3 2010 Norway 100 ## 4 2006 Norway 100 ## 5 2021 Norway 42.9 # pat_classified$missing_data # Call list item directly or... nuts_get_missing(pat_classified) # ...use helper function ## # A tibble: 0 × 4 ## # ℹ 4 variables: from_code , from_version , ## # from_level , country "},{"path":"https://aaoritz.github.io/nuts/articles/nuts.html","id":"converting-data-between-nuts-versions","dir":"Articles","previous_headings":"Usage","what":"Converting data between NUTS versions","title":"nuts: Convert European Regional Data in R","text":"NUTS version level original data identified, can easily convert data NUTS version. example transforming 2013 Norwegian data 2021 NUTS version. 2016 2021, number NUTS-2 regions Norway decreased one borders six regions transformed. maps show affected regions. provide classified NUTS data, specify target NUTS version data transformation, supply variable containing values interpolated. important indicate variable type named input-vector since interpolation approaches differ absolute relative values. Converting patent data versions; Sources: Shapefiles data EUROSTAT; Created using sf package. output displays corresponding data frames based original converted NUTS codes. original data set comprises seven observations, whereas converted data set contains six. regions NO01, NO03, NO04, NO05 lost, NO08, NO09, NO0A now listed.","code":"# Converting Data to 2021 NUTS version pat_converted <- nuts_convert_version( data = pat_classified, to_version = \"2021\", variables = c(\"values\" = \"relative\") ) pat_n2_mhab_12_no ## # A tibble: 7 × 3 ## geo time values ## ## 1 NO01 2012 125. ## 2 NO02 2012 13.2 ## 3 NO03 2012 57.4 ## 4 NO04 2012 110. ## 5 NO05 2012 48.9 ## 6 NO06 2012 145. ## 7 NO07 2012 16.5 pat_converted ## # A tibble: 6 × 4 ## to_code to_version country values ## ## 1 NO02 2021 Norway 13.2 ## 2 NO06 2021 Norway 143. ## 3 NO07 2021 Norway 16.5 ## 4 NO08 2021 Norway 71.0 ## 5 NO09 2021 Norway 83.0 ## 6 NO0A 2021 Norway 58.9"},{"path":"https://aaoritz.github.io/nuts/articles/nuts.html","id":"converting-multiple-variables-simultaneously","dir":"Articles","previous_headings":"Usage > Converting data between NUTS versions","what":"Converting multiple variables simultaneously","title":"nuts: Convert European Regional Data in R","text":"can also convert multiple variables . , add number patent applications per 1000 inhabitants second variable:","code":"# Converting Multiple Variables pat_n2_mhab_12_no %>% mutate(values_per_thous = values * 1000) %>% nuts_classify( data = ., nuts_code = \"geo\" ) %>% nuts_convert_version( data = ., to_version = \"2021\", variables = c(\"values\" = \"relative\", \"values_per_thous\" = \"relative\") ) ## # A tibble: 6 × 5 ## to_code to_version country values values_per_thous ## ## 1 NO02 2021 Norway 13.2 13239 ## 2 NO06 2021 Norway 143. 143106. ## 3 NO07 2021 Norway 16.5 16463 ## 4 NO08 2021 Norway 71.0 71037. ## 5 NO09 2021 Norway 83.0 82964. ## 6 NO0A 2021 Norway 58.9 58904."},{"path":"https://aaoritz.github.io/nuts/articles/nuts.html","id":"converting-grouped-data","dir":"Articles","previous_headings":"Usage > Converting data between NUTS versions","what":"Converting grouped data","title":"nuts: Convert European Regional Data in R","text":"Longitudinal regional data, commonly supplied EUROSTAT, often comes varying NUTS versions across countries years (dimensions). possible harmonize data across groups group_vars argument nuts_classify(). , transform data within country year groups Sweden, Slovenia, Croatia 2021 NUTS version. Note detected best-fitting NUTS versions differ across countries: grouping stored passed conversion function: Conveniently, group argument can also used transform higher dimensional data. , include two indicators patent applications convert data varies indicator-year-country-NUTS code level.","code":"# Classifying grouped data (time) pat_n2_mhab_sesihr <- pat_n2 %>% filter(unit == \"P_MHAB\") %>% filter(str_detect(geo, \"^SE|^SI|^HR\")) pat_classified <- nuts_classify(nuts_code = \"geo\", data = pat_n2_mhab_sesihr, group_vars = \"time\") nuts_get_data(pat_classified) %>% group_by(country, from_version) %>% tally() ## # A tibble: 3 × 3 ## # Groups: country [3] ## country from_version n ## ## 1 Croatia 2016 24 ## 2 Slovenia 2010 26 ## 3 Sweden 2021 104 # Converting grouped data (Time) pat_converted <- nuts_convert_version( data = pat_classified, to_version = \"2021\", variables = c(\"values\" = \"relative\") ) # Classifying and converting multi-group data pat_n2_mhabmact_12_sesihr <- pat_n2 %>% filter(unit %in% c(\"P_MHAB\", \"P_MACT\")) %>% filter(str_detect(geo, \"^SE|^SI|^HR\")) pat_converted <- pat_n2_mhabmact_12_sesihr %>% nuts_classify( data = ., nuts_code = \"geo\", group_vars = c(\"time\", \"unit\") ) %>% nuts_convert_version( data = ., to_version = \"2021\", variables = c(\"values\" = \"relative\") )"},{"path":"https://aaoritz.github.io/nuts/articles/nuts.html","id":"converting-data-between-nuts-levels","dir":"Articles","previous_headings":"Usage","what":"Converting data between NUTS levels","title":"nuts: Convert European Regional Data in R","text":"nuts_aggregate() function facilitates aggregation data lower NUTS levels higher ones using spatial weights. enables users summarize variables upward NUTS-3 level NUTS-2 NUTS-1 levels. important note function support disaggregation since comes strong assumptions spatial distribution variable’s values. following example, illustrate aggregate total number patent applications Sweden NUTS-3 higher levels. functions return warning concerning non-identifiable NUTS codes. See Non-identified NUTS codes information. Aggregating patents NUTS 3 NUTS 2 NUTS 1; Sources: Shapefiles data EUROSTAT; Created using sf package.","code":"data(\"patents\", package = \"nuts\") # Aggregating data from NUTS-3 to NUTS-2 and NUTS-1 pat_n3 <- patents %>% filter(nchar(geo) == 5) pat_n3_nr_12_se <- pat_n3 %>% filter(unit %in% c(\"NR\")) %>% filter(time == 2012) %>% filter(str_detect(geo, \"^SE\")) pat_classified <- nuts_classify( data = pat_n3_nr_12_se, nuts_code = \"geo\" ) pat_level2 <- nuts_aggregate( data = pat_classified, to_level = 2, variables = c(\"values\" = \"absolute\") ) pat_level1 <- nuts_aggregate( data = pat_classified, to_level = 1, variables = c(\"values\" = \"absolute\") )"},{"path":[]},{"path":"https://aaoritz.github.io/nuts/articles/nuts.html","id":"nuts_not_identified","dir":"Articles","previous_headings":"Usage > Inconsistent versions and levels","what":"Non-identified NUTS codes","title":"nuts: Convert European Regional Data in R","text":"input data contains NUTS codes identified NUTS version, output classify_nuts lists codes. conversion procedures (nuts_convert_version() nuts_aggregate()) work expected ignoring values regions. example classifies 2012 patent data Denmark. original EUROSTAT data contains codes DKZZZ DKXXX, part conversion matrices. Codes ending letter Z refer “Extra-Regio” territories. codes collect statistics territories attached certain region.3 Codes ending letter X refer observations unknown regions.","code":"pat_n3.nr.12.dk <- pat_n3 %>% filter(unit %in% c(\"NR\")) %>% filter(time == 2012) %>% filter(str_detect(geo, \"^DK\")) pat_classified <- nuts_classify( data = pat_n3.nr.12.dk, nuts_code = \"geo\" )"},{"path":"https://aaoritz.github.io/nuts/articles/nuts.html","id":"missing-nuts-codes","dir":"Articles","previous_headings":"Usage > Inconsistent versions and levels","what":"Missing NUTS codes","title":"nuts: Convert European Regional Data in R","text":"nuts_classify() also checks whether NUTS codes provided complete. Missing values input data , default, result missing values affected transformed regions output data. example illustrates case. nuts_classify() returns warning NUTS codes missing input data. codes can inspected calling nuts_get_missing(pat_classified). resulting conversion returns three missing values source code SI011 transformed SI031 region SI016 split SI036 SI037. Users three options overcome problem. warning can ignored conversion proceeds returning NAs (see ). Users check whether missing values can replaced , e.g., using alternative sources imputing missing values. argument missing_rm can set TRUE. case, missing values removed input data. Effectively, interpolation procedures assume missing values can replaced 0, may strong assumption depending context.","code":"pat_n3_nr_12_si <- pat_n3 %>% filter(unit %in% c(\"NR\")) %>% filter(time == 2012) %>% filter(str_detect(geo, \"^SI\")) pat_classified <- nuts_classify( data = pat_n3_nr_12_si, nuts_code = \"geo\" ) nuts_get_missing(pat_classified) ## # A tibble: 2 × 4 ## from_code from_version from_level country ## ## 1 SI011 2010 3 Slovenia ## 2 SI016 2010 3 Slovenia nuts_convert_version( data = pat_classified, to_version = \"2021\", variables = c(\"values\" = \"absolute\") ) %>% filter(is.na(values)) ## # A tibble: 3 × 4 ## to_code to_version country values ## ## 1 SI031 2021 Slovenia NA ## 2 SI036 2021 Slovenia NA ## 3 SI037 2021 Slovenia NA nuts_convert_version( data = pat_classified, to_version = \"2021\", variables = c(\"values\" = \"absolute\"), missing_rm = TRUE ) %>% filter(to_code %in% c(\"SI031\", \"SI036\", \"SI037\")) ## # A tibble: 3 × 4 ## to_code to_version country values ## ## 1 SI031 2021 Slovenia 0 ## 2 SI036 2021 Slovenia 0.544 ## 3 SI037 2021 Slovenia 4.02"},{"path":"https://aaoritz.github.io/nuts/articles/nuts.html","id":"multiple-nuts-levels-within-groups","dir":"Articles","previous_headings":"Usage > Inconsistent versions and levels","what":"Multiple NUTS levels within groups","title":"nuts: Convert European Regional Data in R","text":"package allow conversion multiple NUTS levels . classification function throw error case. conversion needs conducted every level separately.","code":"patents %>% filter(nchar(geo) %in% c(4, 5), grepl(\"^EL\", geo)) %>% distinct(geo, .keep_all = T) %>% nuts_classify(nuts_code = \"geo\", data = .) ## Error in `nuts_classify()`: ## ! Data contains NUTS codes from multiple levels (2 and 3)."},{"path":"https://aaoritz.github.io/nuts/articles/nuts.html","id":"multiple-nuts-versions-within-groups","dir":"Articles","previous_headings":"Usage > Inconsistent versions and levels","what":"Multiple NUTS versions within groups","title":"nuts: Convert European Regional Data in R","text":"Converting multiple NUTS versions within groups might lead erroneous spatial interpolations since overlaps regions different versions possible. example illustrates problem. classify German Italian manure storage facility data EUROSTAT without specifying group_vars. Instead, keep unique NUTS codes artificially create data set containing different NUTS versions. nuts_classify() returns warning inspecting identified versions, see mixed versions within groups (countries). proceeding conversion either nuts_convert_version() nuts_aggregate(), functions throw error. convenience, added option multiple_versions subsets supplied data dominant version within groups specified most_frequent. Hence, codes , non-dominant versions discarded. convert data set, NUTS regions unrecognized according 2006 (Germany) 2021 (Italy) version dropped automatically.","code":"man_deit <- manure %>% filter(grepl(\"^DE|^IT\", geo)) %>% filter(nchar(geo) == 4, ) %>% distinct(geo, .keep_all = T) %>% nuts_classify(nuts_code = \"geo\", data = .) nuts_get_data(man_deit) %>% group_by(country, from_version) %>% tally() ## # A tibble: 5 × 3 ## # Groups: country [3] ## country from_version n ## ## 1 Germany 2006 38 ## 2 Germany 2021 3 ## 3 Italy 2006 9 ## 4 Italy 2021 21 ## 5 NA NA 1 man_deit_converted <- nuts_convert_version( data = man_deit, to_version = 2021, variables = c(\"values\" = \"relative\"), multiple_versions = \"most_frequent\" ) man_deit_converted %>% group_by(country, to_version) %>% tally() ## # A tibble: 2 × 3 ## # Groups: country [2] ## country to_version n ## ## 1 Germany 2021 38 ## 2 Italy 2021 21"},{"path":"https://aaoritz.github.io/nuts/articles/nuts.html","id":"method","dir":"Articles","previous_headings":"","what":"Spatial interpolation in detail","title":"nuts: Convert European Regional Data in R","text":"section describes spatial interpolation procedure. first cover logic conversion tables explain methods used package converting versions levels.","code":""},{"path":"https://aaoritz.github.io/nuts/articles/nuts.html","id":"changes-in-administrative-boundaries","dir":"Articles","previous_headings":"Spatial interpolation in detail","what":"Changes in administrative boundaries","title":"nuts: Convert European Regional Data in R","text":", Norwegian NUTS-2 regions versions 2016 2021 shown. regions apart Norway’s Northern region reorganized period. Norwegian NUTS-2 regions boundary changes; Sources: Shapefiles EUROSTAT; Created using sf package. changes two versions can summarized follows: Boundary changes regions continued NUTS codes NO02 ceases small area new NO08 NO06 makes small area gains NO05 Changes regions discontinued NUTS codes NO01 absorbed NO08 NO03 split NO08 NO09 NO04 divides NO0A NO09 NO05 largely becomes new NO0A, gives small area NO06","code":""},{"path":"https://aaoritz.github.io/nuts/articles/nuts.html","id":"spatial-interpolation-and-conversion-tables","dir":"Articles","previous_headings":"Spatial interpolation in detail","what":"Spatial interpolation and conversion tables","title":"nuts: Convert European Regional Data in R","text":"keep track changes, nuts package uses regional flows different NUTS versions. package ships conversion table can called data(cross_walks) based data provided JRC. documents boundary changes NUTS regions. Norway going version 2016 2021, table looks follows: addition tracing evolution NUTS codes, table contains flows area, population artificial surfaces regions versions. flows computed JRC granular [100m x 100m] geographic data. ggalluvial plot visualizes flows area size NUTS-2 regions mapped . Alluvial plot illustrating area size flows; Created using ggalluvial package. illustrate main idea, map showcases population densities across NUTS-2 regions. population uniformly distributed across space, weighting regions dependent area size comes strong assumptions. instance, region NO01 version 2016, contains city Oslo, makes relatively modest geographical contribution new region NO08, significantly bolsters population latter. Assuming variable converted correlated population across space, conversion can thus refined using population weights account flows different versions. Spatial distribution population boundary changes; Sources: Shapefiles population raster EUROSTAT; Created using sf terra packages.","code":""},{"path":"https://aaoritz.github.io/nuts/articles/nuts.html","id":"conversion-methods","dir":"Articles","previous_headings":"Spatial interpolation in detail","what":"Conversion methods","title":"nuts: Convert European Regional Data in R","text":"following subsections describe method used convert absolute relative values versions levels.","code":""},{"path":"https://aaoritz.github.io/nuts/articles/nuts.html","id":"conversion-of-absolute-values-between-versions","dir":"Articles","previous_headings":"Spatial interpolation in detail > Conversion methods","what":"Conversion of absolute values between versions","title":"nuts: Convert European Regional Data in R","text":"example, transform absolute values, number patent applications (NR) Norway, version 2016 2021, utilizing spatial interpolation based population distribution 2018. conversion employs cross_walks table, includes population flow data (expressed thousands) two NUTS-2 regions source version target version. function joins variable interest, NR, varies across departing NUTS-2 codes (from_code). function initially calculates weight (w) equal population flow’s share total population departing region version 2016 (from_code): obtain number patent applications desired 2021 version, function summarizes data new NUTS regions version 2021 (to_code) taking population-weighted sum flows.","code":""},{"path":"https://aaoritz.github.io/nuts/articles/nuts.html","id":"conversion-of-relative-values-between-versions","dir":"Articles","previous_headings":"Spatial interpolation in detail > Conversion methods","what":"Conversion of relative values between versions","title":"nuts: Convert European Regional Data in R","text":"convert relative values, number patent applications per 1000 inhabitants, nuts_convert_version() departs conversion table seen . focus variable P_MHAB, patent applications per one million inhabitants. function summarizes relative values computing weighted average respect 2018 population flows.","code":""},{"path":"https://aaoritz.github.io/nuts/articles/nuts.html","id":"conversion-of-absolute-values-between-nuts-levels","dir":"Articles","previous_headings":"Spatial interpolation in detail > Conversion methods","what":"Conversion of absolute values between NUTS levels","title":"nuts: Convert European Regional Data in R","text":"function nuts_aggregate() aggregates lower higher order levels, e.g. NUTS-3 NUTS-2. Since higher order regions perfectly split lower order regions NUTS system, function takes simply sum values case absolute variables.","code":""},{"path":"https://aaoritz.github.io/nuts/articles/nuts.html","id":"conversion-of-relative-values-between-nuts-levels","dir":"Articles","previous_headings":"Spatial interpolation in detail > Conversion methods","what":"Conversion of relative values between NUTS levels","title":"nuts: Convert European Regional Data in R","text":"Relative values aggregated nuts_aggregate() computing weighted mean lower order regional levels. convert, example, number patent applications per one million inhabitants NUTS-3 NUTS-2, function adds population size 2018. number patent applications NUTS-2 level computed weighted average using NUTS-3 population numbers.","code":""},{"path":"https://aaoritz.github.io/nuts/articles/nuts.html","id":"citation","dir":"Articles","previous_headings":"","what":"Citation","title":"nuts: Convert European Regional Data in R","text":"Please support development open science citing JRC us work. Joint Research Centre (2022) NUTS converter. https://urban.jrc.ec.europa.eu/tools/nuts-converter Hennicke M, Krause W (2024). nuts: Convert European Regional Data. R package version 0.0.0.9000, https://AAoritz.github.io/nuts/ Bibtex Users:","code":"@Manual{, title = {NUTS converter}, author = {Joint Research Centre}, year = {2022}, url = {https://urban.jrc.ec.europa.eu/tools/nuts-converter}, } @Manual{, title = {nuts: Convert European Regional Data}, author = {Moritz Hennicke and Werner Krause}, year = {2024}, note = {R package version 0.0.0.9000}, url = {https://AAoritz.github.io/nuts/}, }"},{"path":"https://aaoritz.github.io/nuts/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Moritz Hennicke. Author, maintainer. Werner Krause. Author.","code":""},{"path":"https://aaoritz.github.io/nuts/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Hennicke M, Krause W (2024). nuts: Convert European Regional Data. R package version 0.0.0.9000, https://AAoritz.github.io/nuts/.","code":"@Manual{, title = {nuts: Convert European Regional Data}, author = {Moritz Hennicke and Werner Krause}, year = {2024}, note = {R package version 0.0.0.9000}, url = {https://AAoritz.github.io/nuts/}, }"},{"path":"https://aaoritz.github.io/nuts/index.html","id":"nuts-","dir":"","previous_headings":"","what":"Convert European Regional Data in R","title":"Convert European Regional Data in R","text":"Changing administrative regional boundaries time complicates construction consistent regional panel data. nuts package can transform European regional data identified NUTS codes different versions subdivision levels aim harmonize link data sets. package’s main task convert data NUTS versions use: 2006, 2010, 2013, 2016 2021. conversions can performed direction based spatial interpolation using five different weights (regional area square kilometers, 2011 2018 population size, 2012 2018 built-area). weights based conversion tables provided Joint Research Center (JRC) European Commission (EC) used online converter. nuts package permits conversion offline additional advantages conversion within groups, enabling conversion datasets multiple NUTS versions efficiently.","code":""},{"path":"https://aaoritz.github.io/nuts/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Convert European Regional Data in R","text":"can install recent development version Github:","code":"pak::pak(\"AAoritz/nuts\")"},{"path":"https://aaoritz.github.io/nuts/index.html","id":"usage","dir":"","previous_headings":"","what":"Usage","title":"Convert European Regional Data in R","text":"Check website example usage details.","code":""},{"path":"https://aaoritz.github.io/nuts/index.html","id":"verbosity-control","dir":"","previous_headings":"","what":"Verbosity Control","title":"Convert European Regional Data in R","text":"Console messages can controlled rlang::local_options(nuts.verbose = \"quiet\") silence messages setting nuts.verbose = \"verbose\" switch messages back .","code":""},{"path":"https://aaoritz.github.io/nuts/index.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Convert European Regional Data in R","text":"Please support development open science data citing JRC us work: Joint Research Centre (2022) NUTS converter. https://urban.jrc.ec.europa.eu/tools/nuts-converter Hennicke M, Krause W (2024). nuts: Convert European Regional Data. R package version 0.0.0.9000, https://AAoritz.github.io/nuts/. Bibtex Users:","code":"@Manual{, title = {NUTS converter}, author = {Joint Research Centre}, year = {2022}, url = {https://urban.jrc.ec.europa.eu/tools/nuts-converter}, } @Manual{, title = {nuts: Convert European Regional Data}, author = {Moritz Hennicke and Werner Krause}, year = {2024}, note = {R package version 0.0.0.9000}, url = {https://AAoritz.github.io/nuts/}, }"},{"path":"https://aaoritz.github.io/nuts/reference/all_nuts_codes.html","id":null,"dir":"Reference","previous_headings":"","what":"List of all NUTS codes and classifications — all_nuts_codes","title":"List of all NUTS codes and classifications — all_nuts_codes","text":"data frame stores NUTS codes hierarchical levels 1, 2 3 NUTS classification versions 2006, 2010, 2013, 2016 2021.","code":""},{"path":"https://aaoritz.github.io/nuts/reference/all_nuts_codes.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"List of all NUTS codes and classifications — all_nuts_codes","text":"","code":"all_nuts_codes"},{"path":[]},{"path":"https://aaoritz.github.io/nuts/reference/all_nuts_codes.html","id":"all-nuts-codes","dir":"Reference","previous_headings":"","what":"all_nuts_codes","title":"List of all NUTS codes and classifications — all_nuts_codes","text":"data frame 8,896 rows 2 columns: code NUTS code version NUTS versions country Country name","code":""},{"path":"https://aaoritz.github.io/nuts/reference/all_nuts_codes.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"List of all NUTS codes and classifications — all_nuts_codes","text":"https://urban.jrc.ec.europa.eu/nutsconverter/#/","code":""},{"path":"https://aaoritz.github.io/nuts/reference/cross_walks.html","id":null,"dir":"Reference","previous_headings":"","what":"Conversion table provided by the Joint Research Center of the European Commission — cross_walks","title":"Conversion table provided by the Joint Research Center of the European Commission — cross_walks","text":"table contains population, area surface flows two NUTS regions different NUTS code classifications. NUTS regions 1st, 2nd 3rd level. NUTS versions 2006, 2010, 2013, 2016 2021.","code":""},{"path":"https://aaoritz.github.io/nuts/reference/cross_walks.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Conversion table provided by the Joint Research Center of the European Commission — cross_walks","text":"","code":"cross_walks"},{"path":[]},{"path":"https://aaoritz.github.io/nuts/reference/cross_walks.html","id":"cross-walks","dir":"Reference","previous_headings":"","what":"cross_walks","title":"Conversion table provided by the Joint Research Center of the European Commission — cross_walks","text":"data frame 47,340 rows 9 columns: from_code Departing NUTS code to_code Desired NUTS code from_version Departing NUTS version to_version Desired NUTS version level NUTS division level country Country name areaKm Area size flow pop18 2018 population flow pop11 2011 population flow artif_surf18 2018 artificial surfaces flow artif_surf12 2012 artificial surfaces flow","code":""},{"path":"https://aaoritz.github.io/nuts/reference/cross_walks.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Conversion table provided by the Joint Research Center of the European Commission — cross_walks","text":"https://urban.jrc.ec.europa.eu/nutsconverter/#/","code":""},{"path":"https://aaoritz.github.io/nuts/reference/manure.html","id":null,"dir":"Reference","previous_headings":"","what":"Manure storage facilities by NUTS 3 regions from Eurostat (aei_fm_ms) — manure","title":"Manure storage facilities by NUTS 3 regions from Eurostat (aei_fm_ms) — manure","text":"data frame contains number different manure storage facilities Farm Structure Survey (former) EU member states, Iceland, Norway, Switzerland Montenegro NUTS 3 level. Please see link indicated information.","code":""},{"path":"https://aaoritz.github.io/nuts/reference/manure.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Manure storage facilities by NUTS 3 regions from Eurostat (aei_fm_ms) — manure","text":"","code":"manure"},{"path":[]},{"path":"https://aaoritz.github.io/nuts/reference/manure.html","id":"manure","dir":"Reference","previous_headings":"","what":"manure","title":"Manure storage facilities by NUTS 3 regions from Eurostat (aei_fm_ms) — manure","text":"data frame 17,151 rows 4 columns: indic_ag 9 indicators: manure storage facilities, solid dung, liquid manure slurry, slurry: tank, slurry: lagoon; covered facilities either dung, liquid manure, slurry geo NUTS 1, 2, 3 National level time Years 2000, 2003 2010 values Number","code":""},{"path":"https://aaoritz.github.io/nuts/reference/manure.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Manure storage facilities by NUTS 3 regions from Eurostat (aei_fm_ms) — manure","text":"https://ec.europa.eu/eurostat/databrowser/view/aei_fm_ms/default/table?lang=en","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts-package.html","id":null,"dir":"Reference","previous_headings":"","what":"nuts: 'nuts': Convert European Regional Data — nuts-package","title":"nuts: 'nuts': Convert European Regional Data — nuts-package","text":"Motivated changing administrative boundaries time, 'nuts' package can convert European regional data NUTS codes versions (2006, 2010, 2013, 2016 2021) levels (NUTS 1, NUTS 2 NUTS 3). package uses spatial interpolation based granular (100mx100m) population land use data provided European Commission's Joint Research Center.","code":""},{"path":[]},{"path":"https://aaoritz.github.io/nuts/reference/nuts-package.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"nuts: 'nuts': Convert European Regional Data — nuts-package","text":"Maintainer: Moritz Hennicke AAoritz@posteo.de (ORCID) Authors: Werner Krause werner.krause@uni-potsdam.de (ORCID)","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_aggregate.html","id":null,"dir":"Reference","previous_headings":"","what":"Aggregate to higher order NUTS levels — nuts_aggregate","title":"Aggregate to higher order NUTS levels — nuts_aggregate","text":"nuts_aggregate() transforms regional NUTS data NUTS levels.","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_aggregate.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Aggregate to higher order NUTS levels — nuts_aggregate","text":"","code":"nuts_aggregate( data, to_level, variables, weight = NULL, missing_rm = FALSE, multiple_versions = c(\"error\", \"most_frequent\") )"},{"path":"https://aaoritz.github.io/nuts/reference/nuts_aggregate.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Aggregate to higher order NUTS levels — nuts_aggregate","text":"data nuts.classified object returned nuts_classify(). to_level Number corresponding desired NUTS level aggregated : 1 2. variables Named character specifying variable names variable type ('absolute' 'relative'), e.g. c('var_name' = 'absolute'). weight String name weight used conversion. Can area size 'areaKm' (default), population 2011 'pop11' 2018 'pop18', artificial surfaces 2012 'artif_surf12' 2018 'artif_surf18'. missing_rm Boolean FALSE default. TRUE removes regional flows depart missing NUTS codes. multiple_versions default equal 'error', providing multiple NUTS versions within groups. set 'most_frequent' data converted using best-matching NUTS version.","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_aggregate.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Aggregate to higher order NUTS levels — nuts_aggregate","text":"tibble containing NUTS codes, aggregated variable values, possibly grouping variables.","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_aggregate.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Aggregate to higher order NUTS levels — nuts_aggregate","text":"Console messages can controlled rlang::local_options(nuts.verbose = \"quiet\") silence messages nuts.verbose = \"verbose\" switch messages back .","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_aggregate.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Aggregate to higher order NUTS levels — nuts_aggregate","text":"","code":"library(dplyr) #> #> Attaching package: ‘dplyr’ #> The following objects are masked from ‘package:stats’: #> #> filter, lag #> The following objects are masked from ‘package:base’: #> #> intersect, setdiff, setequal, union # Load EUROSTAT data of manure storage deposits data(manure) # Data varies at the NUTS level x indicator x year x country x NUTS code level head(manure) #> # A tibble: 6 × 4 #> indic_ag geo time values #> #> 1 I07A1_EQ_Y AT 2010 97401 #> 2 I07A1_EQ_Y AT1 2010 21388 #> 3 I07A1_EQ_Y AT11 2010 2110 #> 4 I07A1_EQ_Y AT111 2010 270 #> 5 I07A1_EQ_Y AT112 2010 455 #> 6 I07A1_EQ_Y AT113 2010 1385 # Aggregate from NUTS 3 to 2 by indicator x year manure %>% filter(nchar(geo) == 5) %>% nuts_classify(nuts_code = \"geo\", group_vars = c('indic_ag','time')) %>% # Group vars are automatically passed on nuts_aggregate(to_level = 2, variables = c('values'= 'absolute'), weight = 'pop18') #> # A tibble: 4,814 × 5 #> to_code country indic_ag time values #> #> 1 AT11 Austria I07A1_EQ_Y 2010 2110 #> 2 AT11 Austria I07A1_EQ_YC 2010 337 #> 3 AT11 Austria I07A2_EQ_Y 2010 802 #> 4 AT11 Austria I07A2_EQ_YC 2010 756 #> 5 AT11 Austria I07A31_EQ_Y 2010 278 #> 6 AT11 Austria I07A32_EQ_Y 2010 31 #> 7 AT11 Austria I07A3_EQ_YC 2010 261 #> 8 AT11 Austria I07A_EQ_Y 2010 2180 #> 9 AT12 Austria I07A1_EQ_Y 2010 19250 #> 10 AT12 Austria I07A1_EQ_YC 2010 1853 #> # ℹ 4,804 more rows"},{"path":"https://aaoritz.github.io/nuts/reference/nuts_classify.html","id":null,"dir":"Reference","previous_headings":"","what":"Classify version of NUTS codes — nuts_classify","title":"Classify version of NUTS codes — nuts_classify","text":"nuts_classify() can identify NUTS version year level variable containing NUTS codes.","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_classify.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Classify version of NUTS codes — nuts_classify","text":"","code":"nuts_classify( data, nuts_code, group_vars = NULL, ties = c(\"most_recent\", \"oldest\") )"},{"path":"https://aaoritz.github.io/nuts/reference/nuts_classify.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Classify version of NUTS codes — nuts_classify","text":"data data frame tibble contains variable NUTS 1, 2 3 codes possibly variables. NUTS codes must level need unique, unless additional grouping variables specified. duplicate NUTS codes within groups allowed. nuts_code Variable name containing NUTS codes group_vars Variable name(s) classification within groups. nuts_classify() always computes overlap within country. Hence, country variables specified. NULL default. ties Picks 'most_recent' 'oldest' version overlap identical across multiple NUTS versions. 'most_recent' default.","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_classify.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Classify version of NUTS codes — nuts_classify","text":"list three tibbles. first tibble contains original data classified NUTS version, level, country. second tibble lists group-specific overlap NUTS version. third tibble shows missing NUTS codes group. output can passed nuts_convert_version() convert data across NUTS versions nuts_aggregate() aggregate across NUTS levels.","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_classify.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Classify version of NUTS codes — nuts_classify","text":"Console messages can controlled rlang::local_options(nuts.verbose = \"quiet\") silence messages nuts.verbose = \"verbose\" switch messages back .","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_classify.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Classify version of NUTS codes — nuts_classify","text":"","code":"library(dplyr) # Load EUROSTAT data of manure storage deposits data(manure) # Data varies at the NUTS level x indicator x year x country x NUTS code level head(manure) #> # A tibble: 6 × 4 #> indic_ag geo time values #> #> 1 I07A1_EQ_Y AT 2010 97401 #> 2 I07A1_EQ_Y AT1 2010 21388 #> 3 I07A1_EQ_Y AT11 2010 2110 #> 4 I07A1_EQ_Y AT111 2010 270 #> 5 I07A1_EQ_Y AT112 2010 455 #> 6 I07A1_EQ_Y AT113 2010 1385 # Classify version of NUTS 2 codes in Germany manure %>% filter(nchar(geo) == 4) %>% filter(indic_ag == 'I07A_EQ_Y') %>% filter(grepl('^DE', geo)) %>% filter(time == 2003) %>% select(-indic_ag, -time) %>% # Data varies at the NUTS code level nuts_classify(nuts_code = 'geo') #> $data #> # A tibble: 36 × 5 #> from_code from_version from_level country values #> #> 1 DE11 2006 2 Germany 11320 #> 2 DE12 2006 2 Germany 3710 #> 3 DE13 2006 2 Germany 9710 #> 4 DE14 2006 2 Germany 11220 #> 5 DE21 2006 2 Germany 22760 #> 6 DE22 2006 2 Germany 16390 #> 7 DE23 2006 2 Germany 12500 #> 8 DE24 2006 2 Germany 8440 #> 9 DE25 2006 2 Germany 10380 #> 10 DE26 2006 2 Germany 6150 #> # ℹ 26 more rows #> #> $versions_data #> # A tibble: 6 × 3 #> from_version country overlap_perc #> #> 1 2006 Germany 100 #> 2 2021 Germany 88.6 #> 3 2016 Germany 88.6 #> 4 2013 Germany 88.6 #> 5 2010 Germany 88.6 #> 6 NA NA NA #> #> $missing_data #> # A tibble: 4 × 4 #> from_code from_version from_level country #> #> 1 DE30 2006 2 Germany #> 2 DE50 2006 2 Germany #> 3 DE60 2006 2 Germany #> 4 DEC0 2006 2 Germany #> #> attr(,\"groups\") #> [1] \"country\" #> attr(,\"class\") #> [1] \"nuts.classified\" \"list\" # Classify version of NUTS 3 codes within country and year manure %>% filter(nchar(geo) == 5) %>% filter(indic_ag == 'I07A_EQ_Y') %>% select(-indic_ag) %>% # Data varies at the year x country x NUTS code level. The country grouping # is always used by default. nuts_classify(nuts_code = 'geo', group_vars = 'time') #> $data #> # A tibble: 1,902 × 6 #> from_code from_version from_level country time values #> #> 1 AT111 2021 3 Austria 2010 276 #> 2 AT112 2021 3 Austria 2010 482 #> 3 AT113 2021 3 Austria 2010 1422 #> 4 AT121 2021 3 Austria 2010 6889 #> 5 AT122 2021 3 Austria 2010 3133 #> 6 AT123 2021 3 Austria 2010 2027 #> 7 AT124 2021 3 Austria 2010 5870 #> 8 AT125 2021 3 Austria 2010 905 #> 9 AT126 2021 3 Austria 2010 1103 #> 10 AT127 2021 3 Austria 2010 506 #> # ℹ 1,892 more rows #> #> $versions_data #> # A tibble: 312 × 4 #> from_version country time overlap_perc #> #> 1 2021 Austria 2010 100 #> 2 2016 Austria 2010 100 #> 3 2013 Austria 2010 100 #> 4 2010 Austria 2010 100 #> 5 2006 Austria 2010 100 #> 6 2016 Belgium 2000 100 #> 7 2013 Belgium 2000 100 #> 8 2010 Belgium 2000 100 #> 9 2006 Belgium 2000 100 #> 10 2021 Belgium 2000 81.8 #> # ℹ 302 more rows #> #> $missing_data #> # A tibble: 324 × 5 #> from_code from_version from_level country time #> #> 1 CZ010 2021 3 Czechia 2003 #> 2 DK011 2021 3 Denmark 2003 #> 3 DK012 2021 3 Denmark 2003 #> 4 EE001 2016 3 Estonia 2003 #> 5 EE007 2016 3 Estonia 2003 #> 6 EL111 2010 3 Greece 2003 #> 7 EL112 2010 3 Greece 2003 #> 8 EL113 2010 3 Greece 2003 #> 9 EL114 2010 3 Greece 2003 #> 10 EL115 2010 3 Greece 2003 #> # ℹ 314 more rows #> #> attr(,\"groups\") #> [1] \"country\" \"time\" #> attr(,\"class\") #> [1] \"nuts.classified\" \"list\""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_convert_version.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert between NUTS versions — nuts_convert_version","title":"Convert between NUTS versions — nuts_convert_version","text":"nuts_convert_version() transforms regional NUTS data NUTS versions.","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_convert_version.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert between NUTS versions — nuts_convert_version","text":"","code":"nuts_convert_version( data, to_version, variables, weight = NULL, missing_rm = FALSE, multiple_versions = c(\"error\", \"most_frequent\") )"},{"path":"https://aaoritz.github.io/nuts/reference/nuts_convert_version.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert between NUTS versions — nuts_convert_version","text":"data nuts.classified object returned nuts_classify(). to_version String desired NUTS version function convert . Possible versions: '2006', '2010', '2013', '2016' '2021' variables Named character specifying variable names variable type ('absolute' 'relative') e.g. c('var_name' = 'absolute') weight String name weight used conversion. Can area size 'areaKm' (default), population 2011 'pop11' 2018 'pop18', artificial surfaces 2012 'artif_surf12' 2018 'artif_surf18'. missing_rm Boolean FALSE default. TRUE removes regional flows depart missing NUTS codes. multiple_versions default equal 'error', providing multiple NUTS versions within groups. set 'most_frequent' data converted using best-matching NUTS version.","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_convert_version.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert between NUTS versions — nuts_convert_version","text":"tibble containing NUTS codes, converted variable values, possibly grouping variables.","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_convert_version.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Convert between NUTS versions — nuts_convert_version","text":"Console messages can controlled rlang::local_options(nuts.verbose = \"quiet\") silence messages nuts.verbose = \"verbose\" switch messages back .","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_convert_version.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Convert between NUTS versions — nuts_convert_version","text":"","code":"library(dplyr) # Load EUROSTAT data of manure storage deposits data(manure) # Data varies at the NUTS level x indicator x year x country x NUTS code level head(manure) #> # A tibble: 6 × 4 #> indic_ag geo time values #> #> 1 I07A1_EQ_Y AT 2010 97401 #> 2 I07A1_EQ_Y AT1 2010 21388 #> 3 I07A1_EQ_Y AT11 2010 2110 #> 4 I07A1_EQ_Y AT111 2010 270 #> 5 I07A1_EQ_Y AT112 2010 455 #> 6 I07A1_EQ_Y AT113 2010 1385 # Convert NUTS 2 codes in Germany from 2006 to 2021 version manure %>% filter(nchar(geo) == 4) %>% filter(indic_ag == 'I07A_EQ_Y') %>% filter(grepl('^DE', geo)) %>% filter(time == 2003) %>% select(-indic_ag, -time) %>% # Data now only varies at the NUTS code level nuts_classify(nuts_code = \"geo\") %>% nuts_convert_version(to_version = '2021', weight = 'pop18', variables = c('values' = 'absolute')) #> # A tibble: 38 × 4 #> to_code to_version country values #> #> 1 DE11 2021 Germany 11320 #> 2 DE12 2021 Germany 3710 #> 3 DE13 2021 Germany 9710 #> 4 DE14 2021 Germany 11220 #> 5 DE21 2021 Germany 22760 #> 6 DE22 2021 Germany 16390 #> 7 DE23 2021 Germany 12500 #> 8 DE24 2021 Germany 8440 #> 9 DE25 2021 Germany 10380 #> 10 DE26 2021 Germany 6150 #> # ℹ 28 more rows # Convert NUTS 3 codes by country x year, classifying version first manure %>% filter(nchar(geo) == 5) %>% filter(indic_ag == 'I07A_EQ_Y') %>% select(-indic_ag) %>% # Data now varies at the year x NUTS code level nuts_classify(nuts_code = 'geo', group_vars = c('time')) %>% nuts_convert_version(to_version = '2021', weight = 'pop18', variables = c('values' = 'absolute')) #> # A tibble: 2,296 × 5 #> to_code to_version country time values #> #> 1 AT111 2021 Austria 2010 276 #> 2 AT112 2021 Austria 2010 482 #> 3 AT113 2021 Austria 2010 1422 #> 4 AT121 2021 Austria 2010 6889 #> 5 AT122 2021 Austria 2010 3133 #> 6 AT123 2021 Austria 2010 2027 #> 7 AT124 2021 Austria 2010 5870 #> 8 AT125 2021 Austria 2010 905 #> 9 AT126 2021 Austria 2010 1103 #> 10 AT127 2021 Austria 2010 506 #> # ℹ 2,286 more rows"},{"path":"https://aaoritz.github.io/nuts/reference/nuts_get_data.html","id":null,"dir":"Reference","previous_headings":"","what":"Return classified NUTS data — nuts_get_data","title":"Return classified NUTS data — nuts_get_data","text":"nuts_get_data() returns classified data running nuts_classify().","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_get_data.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return classified NUTS data — nuts_get_data","text":"","code":"nuts_get_data(data)"},{"path":"https://aaoritz.github.io/nuts/reference/nuts_get_data.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return classified NUTS data — nuts_get_data","text":"data nuts.classified object returned nuts_classify().","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_get_data.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return classified NUTS data — nuts_get_data","text":"tibble containing original data classified NUTS version, level, country.","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_get_data.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Return classified NUTS data — nuts_get_data","text":"Console messages can controlled rlang::local_options(nuts.verbose = \"quiet\") silence messages nuts.verbose = \"verbose\" switch messages back .","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_get_data.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Return classified NUTS data — nuts_get_data","text":"","code":"library(dplyr) # Load EUROSTAT data of manure storage deposits data(manure) # Classify version of NUTS 2 codes in Germany classified <- manure %>% filter(nchar(geo) == 4) %>% filter(indic_ag == 'I07A_EQ_Y') %>% filter(grepl('^DE', geo)) %>% filter(time == 2003) %>% select(-indic_ag, -time) %>% # Data varies at the NUTS code level nuts_classify(nuts_code = 'geo') nuts_get_data(classified) #> # A tibble: 36 × 5 #> from_code from_version from_level country values #> #> 1 DE11 2006 2 Germany 11320 #> 2 DE12 2006 2 Germany 3710 #> 3 DE13 2006 2 Germany 9710 #> 4 DE14 2006 2 Germany 11220 #> 5 DE21 2006 2 Germany 22760 #> 6 DE22 2006 2 Germany 16390 #> 7 DE23 2006 2 Germany 12500 #> 8 DE24 2006 2 Germany 8440 #> 9 DE25 2006 2 Germany 10380 #> 10 DE26 2006 2 Germany 6150 #> # ℹ 26 more rows"},{"path":"https://aaoritz.github.io/nuts/reference/nuts_get_missing.html","id":null,"dir":"Reference","previous_headings":"","what":"Return missing NUTS codes in classified NUTS data — nuts_get_missing","title":"Return missing NUTS codes in classified NUTS data — nuts_get_missing","text":"nuts_get_missing() returns classified data running nuts_classify().","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_get_missing.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return missing NUTS codes in classified NUTS data — nuts_get_missing","text":"","code":"nuts_get_missing(data)"},{"path":"https://aaoritz.github.io/nuts/reference/nuts_get_missing.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return missing NUTS codes in classified NUTS data — nuts_get_missing","text":"data nuts.classified object returned nuts_classify().","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_get_missing.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return missing NUTS codes in classified NUTS data — nuts_get_missing","text":"tibble listing missing NUTS codes group.","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_get_missing.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Return missing NUTS codes in classified NUTS data — nuts_get_missing","text":"Console messages can controlled rlang::local_options(nuts.verbose = \"quiet\") silence messages nuts.verbose = \"verbose\" switch messages back .","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_get_missing.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Return missing NUTS codes in classified NUTS data — nuts_get_missing","text":"","code":"library(dplyr) # Load EUROSTAT data of manure storage deposits data(manure) # Classify version of NUTS 2 codes in Germany classified <- manure %>% filter(nchar(geo) == 4) %>% filter(indic_ag == 'I07A_EQ_Y') %>% filter(grepl('^DE', geo)) %>% filter(time == 2003) %>% select(-indic_ag, -time) %>% # Data varies at the NUTS code level nuts_classify(nuts_code = 'geo') nuts_get_missing(classified) #> # A tibble: 4 × 4 #> from_code from_version from_level country #> #> 1 DE30 2006 2 Germany #> 2 DE50 2006 2 Germany #> 3 DE60 2006 2 Germany #> 4 DEC0 2006 2 Germany"},{"path":"https://aaoritz.github.io/nuts/reference/nuts_get_version.html","id":null,"dir":"Reference","previous_headings":"","what":"Return version overlap of classified NUTS data — nuts_get_version","title":"Return version overlap of classified NUTS data — nuts_get_version","text":"nuts_get_version() returns classified data running nuts_classify().","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_get_version.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return version overlap of classified NUTS data — nuts_get_version","text":"","code":"nuts_get_version(data)"},{"path":"https://aaoritz.github.io/nuts/reference/nuts_get_version.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return version overlap of classified NUTS data — nuts_get_version","text":"data nuts.classified object returned nuts_classify().","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_get_version.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return version overlap of classified NUTS data — nuts_get_version","text":"tibble lists group-specific overlap NUTS version.","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_get_version.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Return version overlap of classified NUTS data — nuts_get_version","text":"Console messages can controlled rlang::local_options(nuts.verbose = \"quiet\") silence messages nuts.verbose = \"verbose\" switch messages back .","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_get_version.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Return version overlap of classified NUTS data — nuts_get_version","text":"","code":"library(dplyr) # Load EUROSTAT data of manure storage deposits data(manure) # Classify version of NUTS 2 codes in Germany classified <- manure %>% filter(nchar(geo) == 4) %>% filter(indic_ag == 'I07A_EQ_Y') %>% filter(grepl('^DE', geo)) %>% filter(time == 2003) %>% select(-indic_ag, -time) %>% # Data varies at the NUTS code level nuts_classify(nuts_code = 'geo') nuts_get_version(classified) #> # A tibble: 6 × 3 #> from_version country overlap_perc #> #> 1 2006 Germany 100 #> 2 2021 Germany 88.6 #> 3 2016 Germany 88.6 #> 4 2013 Germany 88.6 #> 5 2010 Germany 88.6 #> 6 NA NA NA"},{"path":"https://aaoritz.github.io/nuts/reference/nuts_test_multiple_versions.html","id":null,"dir":"Reference","previous_headings":"","what":"Helper function to test for multiple versions — nuts_test_multiple_versions","title":"Helper function to test for multiple versions — nuts_test_multiple_versions","text":"nuts_test_multiple_versions called either nuts_convert_version nuts_aggregate selects frequent version within groups throw error.","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_test_multiple_versions.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Helper function to test for multiple versions — nuts_test_multiple_versions","text":"","code":"nuts_test_multiple_versions(group_vars, multiple_versions, data_versions, data)"},{"path":"https://aaoritz.github.io/nuts/reference/nuts_test_multiple_versions.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Helper function to test for multiple versions — nuts_test_multiple_versions","text":"group_vars Variable name(s) classification within groups. Always computes overlap within country. NULL default. multiple_versions default equal 'error', providing multiple NUTS versions within groups. data_versions Data versions data nuts.classified object returned nuts_classify().","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_test_multiple_versions.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Helper function to test for multiple versions — nuts_test_multiple_versions","text":"tibble containing NUTS codes, potential number rows dropped message results test.","code":""},{"path":"https://aaoritz.github.io/nuts/reference/nuts_test_multiple_versions.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Helper function to test for multiple versions — nuts_test_multiple_versions","text":"","code":"library(dplyr) df <- manure %>% filter(nchar(geo) == 5) %>% select(geo, indic_ag, values) %>% distinct(geo, .keep_all = TRUE) %>% nuts_classify(nuts_code = \"geo\", group_vars = \"indic_ag\", data = .) nuts_test_multiple_versions(group_vars = \"indic_ag\", multiple_versions = \"most_frequent\", data_versions = df$versions_data, data = df$data) #> $data #> # A tibble: 282 × 8 #> from_code from_version from_level country.x indic_ag values country.y #> #> 1 AT111 2021 3 Austria I07A1_EQ_Y 270 Austria #> 2 AT112 2021 3 Austria I07A1_EQ_Y 455 Austria #> 3 AT113 2021 3 Austria I07A1_EQ_Y 1385 Austria #> 4 AT121 2021 3 Austria I07A1_EQ_Y 6485 Austria #> 5 AT122 2021 3 Austria I07A1_EQ_Y 2988 Austria #> 6 AT123 2021 3 Austria I07A1_EQ_Y 1799 Austria #> 7 AT124 2021 3 Austria I07A1_EQ_Y 5668 Austria #> 8 AT125 2021 3 Austria I07A1_EQ_Y 848 Austria #> 9 AT126 2021 3 Austria I07A1_EQ_Y 979 Austria #> 10 AT127 2021 3 Austria I07A1_EQ_Y 483 Austria #> # ℹ 272 more rows #> # ℹ 1 more variable: overlap_perc #> #> $n_rows_dropped #> [1] 739 #> #> $message_multiple_versions #> ! #> \"{.blue Choosing most frequent version within group and {.red dropping} {n_rows_dropped} row{?s}.}\" #>"},{"path":"https://aaoritz.github.io/nuts/reference/patents.html","id":null,"dir":"Reference","previous_headings":"","what":"Patent applications to the EPO by priority year by NUTS 3 regions (pat_ep_rtot) — patents","title":"Patent applications to the EPO by priority year by NUTS 3 regions (pat_ep_rtot) — patents","text":"data frame contains information patent applications European Patent Office year NUTS 3 regions.","code":""},{"path":"https://aaoritz.github.io/nuts/reference/patents.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Patent applications to the EPO by priority year by NUTS 3 regions (pat_ep_rtot) — patents","text":"","code":"patents"},{"path":[]},{"path":"https://aaoritz.github.io/nuts/reference/patents.html","id":"patents","dir":"Reference","previous_headings":"","what":"patents","title":"Patent applications to the EPO by priority year by NUTS 3 regions (pat_ep_rtot) — patents","text":"data frame 104,106 rows 4 columns: unit 4 indicators: Number, Nominal GDP billion euro, Per million habitants, Per million population labor force geo NUTS 1, 2, 3 National level time Years 2008, 2009, 2010, 2011 2012 values Values","code":""},{"path":"https://aaoritz.github.io/nuts/reference/patents.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Patent applications to the EPO by priority year by NUTS 3 regions (pat_ep_rtot) — patents","text":"https://ec.europa.eu/eurostat/databrowser/view/PAT_EP_RTOT/default/table","code":""},{"path":"https://aaoritz.github.io/nuts/news/index.html","id":"nuts-0009000","dir":"Changelog","previous_headings":"","what":"nuts 0.0.0.9000","title":"nuts 0.0.0.9000","text":"Development version launch","code":""}]