Create an Emission Risk Factors (ERF) Row
erf_row.Rd
Constructs and validates a single row of emission risk factor data for a given country, species, and disease context.
This function serves as a robust helper to generate new entries in the emission risk factors dataset, ensuring
compatibility with subsequent analytical workflows in the riskintroanalysis
package.
The function performs input validation and data cleaning (e.g., coercing numeric fields to integer) and assigns appropriate data types. It ensures the output meets the schema expected by the emission risk scoring system, which uses this data to calculate risk scores across four weighted domains:
Epidemiological status (e.g.,
last_outbreak_end_date
)Surveillance measures (e.g.,
disease_notification
,targeted_surveillance
,general_surveillance
,screening
)Control measures (e.g.,
slaughter
,zoning
,official_vaccination
)Animal commerce (e.g.,
commerce_illegal
,commerce_legal
)
The resulting row includes domain-specific fields that will be used by scoring algorithms such as build_emission_risk_table()
to derive intermediate and final emission risk values.
Usage
erf_row(
iso3,
country,
disease,
animal_category,
species,
disease_notification = 0L,
targeted_surveillance = 0L,
general_surveillance = 0L,
screening = 0L,
precautions_at_the_borders = 0L,
slaughter = 0L,
selective_killing_and_disposal = 0L,
zoning = 0L,
official_vaccination = 0L,
last_outbreak_end_date = as.Date("01/01/1900"),
commerce_illegal = 0L,
commerce_legal = 0L,
data_source = paste0("User ", Sys.info()[["user"]], " - ", Sys.Date())
)
Arguments
- iso3
ISO3 country code (e.g., "FRA"), it should be a valid ISO3 code with a match in column
iso3
returned bycountry_reference()
or a string starting with 'JOKER'.- country
Country name (e.g., "France"), the name is free text, but is expected to match the country name
name_en
orname_fr
in the dataset returned bycountry_reference()
.- disease
Disease name (e.g., "ASF"), it should be a valid disease code or name. For now there is no check for the disease name: it is expected to match the disease name in the dataset of WAHIS diseases but as the data are not covering all deceases, it is not checked so that users can add their own diseases.
- animal_category
Animal category, one of "wild" or "domestic".
- species
Species name (e.g., "pig"), it is a free text. It's expected to match the species name in the dataset returned by WAHIS species dataset but as the data are not covering all species, it is not checked so that users can add their own species.
- disease_notification
Integer (0 or 1). All are either 1 or 0, 0 means 'measure inplace' and 1 means 'no measure inplace', i.e. 1 = there is a risk, 0 = there is no risk.
- targeted_surveillance
Integer (0 or 1). Is targeted surveillance applied? All are either 1 or 0, 0 means 'measure inplace' and 1 means 'no measure inplace', i.e. 1 = there is a risk, 0 = there is no risk.
- general_surveillance
Integer (0 or 1). Is general surveillance applied? All are either 1 or 0, 0 means 'measure inplace' and 1 means 'no measure inplace', i.e. 1 = there is a risk, 0 = there is no risk.
- screening
Integer (0 or 1). Are screening measures in place? All are either 1 or 0, 0 means 'measure inplace' and 1 means 'no measure inplace', i.e. 1 = there is a risk, 0 = there is no risk.
- precautions_at_the_borders
Integer (0 or 1). Are precautions taken at the borders? All are either 1 or 0, 0 means 'measure inplace' and 1 means 'no measure inplace', i.e. 1 = there is a risk, 0 = there is no risk.
- slaughter
Integer (0 or 1). Are slaughter processes in place? All are either 1 or 0, 0 means 'measure inplace' and 1 means 'no measure inplace', i.e. 1 = there is a risk, 0 = there is no risk.
- selective_killing_and_disposal
Integer (0 or 1). Are selective killing and disposal procedures in place? All are either 1 or 0, 0 means 'measure inplace' and 1 means 'no measure inplace', i.e. 1 = there is a risk, 0 = there is no risk.
- zoning
Integer (0 or 1). Are zoning strategies applied? All are either 1 or 0, 0 means 'measure inplace' and 1 means 'no measure inplace', i.e. 1 = there is a risk, 0 = there is no risk.
- official_vaccination
Integer (0 or 1). Are official vaccination programs applied? All are either 1 or 0, 0 means 'measure inplace' and 1 means 'no measure inplace', i.e. 1 = there is a risk, 0 = there is no risk.
- last_outbreak_end_date
Date. The end date of the last outbreak.
- commerce_illegal
Integer (0, 1). Indicators of whether illegal commerce are being conducted.
- commerce_legal
Integer (0, 1). Indicators of whether legal commerce are being conducted.
- data_source
Character. A description of the data source, defaulting to the user name and current date. This is free text.
Value
A tibble::tibble()
object with cleaned, validated, and
structured emission risk factor data. The output is containing the
input parameters stored in a table whose columns are:
iso3
: ISO3 country code (e.g., "FRA"), it should be a valid ISO3 code with a match in columniso3
returned bycountry_reference()
or a string starting with 'JOKER'.country
: Country name (e.g., "France"), the name is free text, but is expected to match the country namename_en
orname_fr
in the dataset returned bycountry_reference()
.disease
: Disease name (e.g., "ASF"), it should be a valid disease code or name. For now there is no check for the disease name: it is expected to match the disease name in the dataset of WAHIS diseases but as the data are not covering all deceases, it is not checked so that users can add their own diseases.animal_category
: Animal category, one of "wild" or "domestic".species
: Species name (e.g., "pig"), it is a free text. It's expected to match the species name in the dataset returned by WAHIS species dataset but as the data are not covering all species, it is not checked so that users can add their own species.disease_notification
: Integer (0 or 1). All are either 1 or 0, 0 means 'measure inplace' and 1 means 'no measure inplace', i.e. 1 = there is a risk, 0 = there is no risk.targeted_surveillance
: Integer (0 or 1). Is targeted surveillance applied? All are either 1 or 0, 0 means 'measure inplace' and 1 means 'no measure inplace', i.e. 1 = there is a risk, 0 = there is no risk.general_surveillance
: Integer (0 or 1). Is general surveillance applied? All are either 1 or 0, 0 means 'measure inplace' and 1 means 'no measure inplace', i.e. 1 = there is a risk, 0 = there is no risk.screening
: Integer (0 or 1). Are screening measures in place? All are either 1 or 0, 0 means 'measure inplace' and 1 means 'no measure inplace', i.e. 1 = there is a risk, 0 = there is no risk.precautions_at_the_borders
: Integer (0 or 1). Are precautions taken at the borders? All are either 1 or 0, 0 means 'measure inplace' and 1 means 'no measure inplace', i.e. 1 = there is a risk, 0 = there is no risk.slaughter
: Integer (0 or 1). Are slaughter processes in place? All are either 1 or 0, 0 means 'measure inplace' and 1 means 'no measure inplace', i.e. 1 = there is a risk, 0 = there is no risk.selective_killing_and_disposal
: Integer (0 or 1). Are selective killing and disposal procedures in place? All are either 1 or 0, 0 means 'measure inplace' and 1 means 'no measure inplace', i.e. 1 = there is a risk, 0 = there is no risk.zoning
: Integer (0 or 1). Are zoning strategies applied? All are either 1 or 0, 0 means 'measure inplace' and 1 means 'no measure inplace', i.e. 1 = there is a risk, 0 = there is no risk.official_vaccination
: Integer (0 or 1). Are official vaccination programs applied? All are either 1 or 0, 0 means 'measure inplace' and 1 means 'no measure inplace', i.e. 1 = there is a risk, 0 = there is no risk.last_outbreak_end_date
: Date. The end date of the last outbreak.commerce_illegal
: Integer (0, 1). Indicators of whether illegal commerce are being conducted.commerce_legal
: Integer (0, 1). Indicators of whether legal commerce are being conducted.data_source
: Character. A description of the data source, defaulting to the user name and current date. This is free text.
See also
Other functions for "Emission Risk Factors" management:
get_erf_weights()
,
get_wahis_erf()
Examples
erf_row(
iso3 = "FRA",
country = "France",
disease = "ASF",
animal_category = "livestock",
species = "pig",
disease_notification = 1,
targeted_surveillance = 1,
general_surveillance = 0,
screening = 1,
precautions_at_the_borders = 1,
slaughter = 1,
selective_killing_and_disposal = 0,
zoning = 1,
official_vaccination = 0,
last_outbreak_end_date = "2020-05-01",
commerce_illegal = 1,
commerce_legal = 1
)
#> ✔ All data in "emission_risk_factors" valided.
#> # A tibble: 1 × 18
#> iso3 country disease animal_category species disease_notification
#> <chr> <chr> <chr> <chr> <chr> <int>
#> 1 FRA France ASF livestock pig 1
#> # ℹ 12 more variables: targeted_surveillance <int>, general_surveillance <int>,
#> # screening <int>, precautions_at_the_borders <int>, slaughter <int>,
#> # selective_killing_and_disposal <int>, zoning <int>,
#> # official_vaccination <int>, last_outbreak_end_date <date>,
#> # commerce_illegal <int>, commerce_legal <int>, data_source <chr>