Validate Total Catch
validate_total_catch.RdAggregates 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_idtotal_catch_kg(potentially set toNAif outlier)alert_total(the alert code orNA_real_)
Details
Groups
databysubmission_id, landing_site, gearand sumscatch_kgintototal_catch_kg.Retrieves outlier bounds from
get_total_catch_bounds.Flags any
total_catch_kgaboveupper.upwithalert_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)
} # }