is_outlier | R Documentation |
This function identifies outliers in a numeric vector x
.
is_outlier(x, ...)
x |
A numeric vector for which outliers need to be identified. |
... |
Additional arguments passed to |
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.
A logical vector of the same length as x
, where TRUE
indicates that
the corresponding element in x
is an outlier.
# 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)]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.