Skip to contents

This function validates the catch data by comparing it to calculated upper bounds from the get_catch_bounds function. If a catch value exceeds the upper bound, an alert is triggered and the catch value is set to NA.

Usage

validate_catch(data = NULL, k = NULL)

Arguments

data

A data frame containing catch data with columns: survey_id, gear, catch_taxon, weight_type, and catch_kg.

k

A numeric value used in the get_catch_bounds function for outlier detection.

Value

A data frame with columns:

  • form_name: The name of the form associated with the survey

  • survey_id: The unique identifier for each survey

  • catch_kg: The original catch weight if valid, otherwise NA

  • alert_catch: A numeric value (4) indicating an outlier, or NA if the value is valid

Details

The function first calculates catch bounds using get_catch_bounds(). It then joins these bounds with the input data and compares each catch_kg value to its corresponding upper bound. If the catch_kg value is greater than or equal to the upper bound, an alert is set and the catch_kg value is changed to NA.