aggregate_for_variable_by_nuts: Data aggregation function for variable and NUTS IDs

Description Usage Arguments Value Examples

View source: R/aggregate_for_variable_by_nuts.R

Description

Aggregates data for a variable and a lists of nuts_ids for each year.

Usage

1
2
3
4
5
6
7
8
aggregate_for_variable_by_nuts(
  nuts_ids,
  VarName,
  aggregation_name,
  group_by = "sum",
  NUTS_level = "all",
  data = EntrancesData
)

Arguments

nuts_ids

vector with character strings with the regional IDs that shall be aggregated.

VarName

character string with the name of the variable.

aggregation_name

ID of the aggregated variable, which will be used instead of the regional ID (NUTS_ID)

group_by

"sum", "mean", "median", indicates whether aggregation should work by using the sum, the mean or the median of the data.

NUTS_level

indicates, if the nuts_ids shall be filtered on a specific NUTS level (NUTS3, NUTS2, NUTS1, NUTS country). Default is all.

data

dataframe, from which you want to extract your data. Default is the EntrancesData dataset

Value

dataframe, with the sum of the values of the variable for each year, with no NAs

Examples

1
2
3
4
#Define a list of NUTS IDs , a variable and the type of aggregation (sum, mean or median) and the name for the regional ID for the aggregation to get a data frame with the aggregated values for each year.
#Additionally you can filter your NUTS IDs for a specific level (NUTS3, NUTS2, NUTS1, NUTS country).
#You can define a data frame, if you don't want to use the EntrancesData data set from the package.
aggregate_for_variable_by_nuts(nuts_ids=c("ITG2B", "ITG2C"), VarName="GDP_EUR", aggregation_name="GDP_Sulcis_NUTS3", group_by="sum", NUTS_level="all", data=EntrancesData)

THartl1/EntrancesDataPackage documentation built on Dec. 18, 2021, 4:01 p.m.