Validate Catch at Taxon Level
validate_catch_taxa.RdFlags outliers in catch_kg by comparing values to upper bounds computed per
gear + catch_taxon group (via get_catch_bounds_taxon).
Rows with catch_kg above the bound receive a numeric alert code and optionally
have their catch_kg set to NA.
Arguments
- data
A data frame containing (at least)
submission_id,gear,catch_taxon, andcatch_kg.- k
A numeric parameter passed to
LocScaleB; used for computing outlier bounds inget_catch_bounds_taxon.- flag_value
A numeric value to assign when
catch_kgexceeds the upper bound. Default is4.
Value
A data frame with the columns:
submission_idCarried from the input data.
catch_taxonCarried from the input data.
catch_kgPotentially modified if outlier.
alert_catchThe alert code
flag_valuefor outliers, orNA_real_if no outlier.
Details
Calls
get_catch_bounds_taxonto retrieve outlier bounds for eachgear + catch_taxongroup.Joins these bounds to
dataongearandcatch_taxon.Rowwise, checks if
catch_kgis greater than the boundupper.up. If so, setsalert_catch = flag_valueand optionally replacescatch_kgwithNA_real_.
Examples
if (FALSE) { # \dontrun{
catch_alert <- validate_catch_taxa(data, k = 3, flag_value = 4)
head(catch_alert)
} # }