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