Generate an Alert Vector Based on Outlier Detection
alert_outlier.Rd
This function uses the univOutl::LocScaleB()
function to detect outliers in a numeric vector
and generates an alert vector based on the results.
Usage
alert_outlier(
x,
no_alert_value = NA_real_,
alert_if_larger = no_alert_value,
alert_if_smaller = no_alert_value,
...
)
Arguments
- x
Numeric vector where outliers will be checked
- no_alert_value
Value to put in the output when there is no alert (x is within bounds)
- alert_if_larger
Alert value for when x is above the bounds found by
univOutl::LocScaleB()
- alert_if_smaller
Alert value for when x is below the bounds found by
univOutl::LocScaleB()
- ...
Additional arguments passed to
univOutl::LocScaleB()
Details
The function first checks if the input vector contains only NA or zero values, or if the median
absolute deviation is zero. In these cases, it returns NA_real_. Otherwise, it uses
univOutl::LocScaleB()
to determine the bounds and generates alerts accordingly.