Validate Total Catch
validate_total_catch.Rd
Aggregates catch_kg
to a total per submission_id, landing_site, gear
,
computes outlier bounds by landing site + gear, and flags outlier total catches.
Outliers are assigned a numeric flag_value
and optionally set to NA
.
Arguments
- data
A data frame containing
submission_id
,landing_site
,gear
, andcatch_kg
.- k
A numeric parameter passed to
LocScaleB
, used for bounding outliers inget_total_catch_bounds
.- flag_value
A numeric value to assign to records whose total catch is above the upper bound. Default is
5
.
Value
A data frame with columns:
submission_id
total_catch_kg
(potentially set toNA
if outlier)alert_total
(the alert code orNA_real_
)
Details
Groups
data
bysubmission_id, landing_site, gear
and sumscatch_kg
intototal_catch_kg
.Retrieves outlier bounds from
get_total_catch_bounds
.Flags any
total_catch_kg
aboveupper.up
withalert_total
. Sets those outlier values toNA_real_
.
Examples
if (FALSE) { # \dontrun{
total_catch_alert <- validate_total_catch(data, k = 3, flag_value = 5)
head(total_catch_alert)
} # }