Validate Catch Price
validate_price.RdDetects outliers in catch_price by gear + catch_taxon, assigning a
numeric alert code to records exceeding the computed upper bound. Outliers can be
replaced with NA.
Arguments
- data
A data frame with
submission_id,gear,catch_taxon, andcatch_price.- k
A numeric parameter passed to
LocScaleB, used inget_price_bounds.- flag_value
A numeric code (default
6) assigned to outlier prices.
Value
A data frame with columns:
submission_idCarried from the input.
catch_taxonCarried from the input.
catch_pricePotentially set to
NAif outlier.alert_priceThe numeric alert code, or
NA.
Details
Calls
get_price_boundsto compute outlier thresholds.Joins thresholds back to
dataviagearandcatch_taxon.Rowwise, flags prices above the
upper.upbound withalert_price, and replaces them withNA_real_.
Examples
if (FALSE) { # \dontrun{
price_alert <- validate_price(data, k = 3, flag_value = 6)
head(price_alert)
} # }