redist_nuts {qPRAentry} | R 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 |
values_col |
A string or vector specifying the column name(s) in |
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
|
redist_nuts_col |
A string specifying the column name in |
redist_values_col |
A string specifying the column name in |
population_year |
A numeric value specifying the year(s) of the human population
data to be used for redistribution. Only necessary if |
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
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")