Validate Catch at Taxon Level
validate_catch_taxa.Rd
Flags 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_kg
exceeds the upper bound. Default is4
.
Value
A data frame with the columns:
submission_id
Carried from the input data.
catch_taxon
Carried from the input data.
catch_kg
Potentially modified if outlier.
alert_catch
The alert code
flag_value
for outliers, orNA_real_
if no outlier.
Details
Calls
get_catch_bounds_taxon
to retrieve outlier bounds for eachgear + catch_taxon
group.Joins these bounds to
data
ongear
andcatch_taxon
.Rowwise, checks if
catch_kg
is greater than the boundupper.up
. If so, setsalert_catch = flag_value
and optionally replacescatch_kg
withNA_real_
.
Examples
if (FALSE) { # \dontrun{
catch_alert <- validate_catch_taxa(data, k = 3, flag_value = 4)
head(catch_alert)
} # }