redist_nuts: Data redistribution to NUTS subdivisions

View source: R/redist_nuts.R

redist_nutsR Documentation

Data redistribution to NUTS subdivisions

Description

Value redistribution from country-level (NUTS0) to smaller territories (i.e., NUTS1, NUTS2 or NUTS3). See Nomenclature of territorial units for statistics.

Usage

redist_nuts(
  data,
  nuts_col,
  values_col,
  to_nuts = 2,
  redist_data = "population",
  redist_nuts_col = NULL,
  redist_values_col = NULL,
  population_year = 2023,
  nuts_year = 2016
)

Arguments

data

A data frame containing the data at the country-level to redistribute.

nuts_col

A string specifying the column name in data with the NUTS0 codes.

values_col

A string or vector specifying the column name(s) in data with the values to be redistributed.

to_nuts

A numeric value (1, 2, or 3) specifying the NUTS level for redistribution. Default 2, indicating redistribution to NUTS2.

redist_data

A data frame containing values for each subdivision that will be used as the basis for proportional redistribution. By default, this is set to "population", indicating redistribution based on human population data from Eurostat.

redist_nuts_col

A string specifying the column name in redist_data that contains the destination NUTS codes. The NUTS level should correspond to the value specified in to_nuts. NULL (default) if a data frame is not incorporated in redist_data (i.e., redist_data = "population").

redist_values_col

A string specifying the column name in redist_data with the values for proportional redistribution. These values will serve as the weights for the redistribution process. NULL (default) if a data frame is not incorporated in redist_data (i.e., redist_data = "population").

population_year

A numeric value specifying the year(s) of the human population data to be used for redistribution. Only necessary if "population" is specified in redist_data (default is 2023). If multiple years are provided, the average human population across those years will be used. Available years can be found at Eurostat.

nuts_year

Year of NUTS classification. Accepted values are '2003','2006','2010','2013', '2016' (default),'2021', or '2024'. See NUTS - History.

Details

This function enables redistribution of values from national-level NUTS0 to smaller territorial units (i.e., NUTS1, NUTS2, or NUTS3), either proportionally based on human population data from Eurostat or using user-supplied redistribution proportions. Human population data for redistribution is automatically fetched for the specified time period from the Eurostat database.

Note that more than one column of values provided in the data frame data can be redistributed at the same time. The values in columns values_col and redist_values_col must be numeric and positive.

Common uses

In the context of quantitative pest risk assessment (qPRA) at the entry step, this function can be applied to redistribute the quantity of potentially infested commodities (N_{trade}, see ntrade()) or the number of potential founder populations (NPFP, see pathway_model()). For this purpose, human population or consumption data from subdivisions are often used for redistribution.

Value

A data frame with the redistributed values across the specified NUTS level. The data frame contains the columns NUTSX with the codes at the selected NUTS level, NUTS0 with the codes at country level, proportion with the proportion according to which the values have been redistributed, and the columns corresponding to the redistributed values with the same name specified in values_col.

See Also

ntrade(), pathway_model()

Examples

## Example of data redistribution to NUTS2 using human population data
data("datatrade_EU")
# extract NUTS0 codes (country level)
nuts0 <- unique(datatrade_EU$internal_production$reporter)
# simulate values for each country
nuts0_data <- data.frame(nuts0 = nuts0,
                         value = abs(rnorm(length(nuts0), 30000, 10000)))


# Redistribution
data_redist <- redist_nuts(data = nuts0_data,
                           nuts_col = "nuts0",
                           values_col = "value",
                           to_nuts = 2,
                           redist_data = "population",
                           population_year = c(2017, 2018, 2019))
head(data_redist)

# Plot
plot_nuts(data = data_redist,
          nuts_level = 2,
          nuts_col = "NUTS2", 
          values_col = "value")


## Example of data redistribution to NUTS1 using custom data
# consumption data at NUTS1 level
nuts1_data <- datatrade_EU$consumption_nuts1

# Redistribution
data_redist <- redist_nuts(data = nuts0_data,
                           nuts_col = "nuts0",
                           values_col = "value",
                           to_nuts = 1,
                           redist_data = nuts1_data,
                           redist_nuts_col = "NUTS_ID",
                           redist_values_col = "value")

head(data_redist)

# Plot
plot_nuts(data = data_redist,
          nuts_level = 1,
          nuts_col = "NUTS1", 
          values_col = "value")


qPRAentry documentation built on April 12, 2025, 1:12 a.m.