This function identifies outliers in a numeric vector x.

is_outlier(x, ...)

Arguments

x

A numeric vector for which outliers need to be identified.

...

Additional arguments passed to boxplot.stats.

Value

A logical vector of the same length as x, where TRUE indicates that the corresponding element in x is an outlier.

Details

An element is considered an outlier if it falls outside the range as defined by boxplot.stats from the grDevices package. The function is useful for quickly flagging or filtering outliers in a dataset.

Examples

# Example vector
data <- c(-10, 1, 2, 3, 4, 5, 100)

# Check for outliers
is_outlier(data)

# Using the function to filter out outliers
data[!is_outlier(data)]