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)
# 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')
# 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')
Run the code above in your browser using DataLab