Skip to contents

Detects 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.

Usage

validate_price(data, k = 3, flag_value = 6)

Arguments

data

A data frame with submission_id, gear, catch_taxon, and catch_price.

k

A numeric parameter passed to LocScaleB, used in get_price_bounds.

flag_value

A numeric code (default 6) assigned to outlier prices.

Value

A data frame with columns:

submission_id

Carried from the input.

catch_taxon

Carried from the input.

catch_price

Potentially set to NA if outlier.

alert_price

The numeric alert code, or NA.

Details

  1. Calls get_price_bounds to compute outlier thresholds.

  2. Joins thresholds back to data via gear and catch_taxon.

  3. Rowwise, flags prices above the upper.up bound with alert_price, and replaces them with NA_real_.

Examples

if (FALSE) { # \dontrun{
price_alert <- validate_price(data, k = 3, flag_value = 6)
head(price_alert)
} # }