| Outlier {DescTools} | R Documentation |
Return outliers following Tukey's boxplot definition.
Outlier(x, method = c("boxplot"), value = TRUE,na.rm = FALSE)
x |
a (non-empty) numeric vector of data values. |
method |
the method to be used. So far only Tukey's boxplot rule is implemented. |
value |
logical. If |
na.rm |
logical. Should missing values be removed? Defaults to |
Outlier detection is a tricky problem and should be handled with care. We implement only Tukey's boxplot rule as a rough idea of spotting extreme values.
the values of x lying outside the whiskers in a boxplot or the indices of them
Andri Signorell <andri@signorell.net>
Outlier(d.pizza$temperature, na.rm=TRUE) # it's the same as the result from boxplot sort(d.pizza$temperature[Outlier(d.pizza$temperature, value=FALSE, na.rm=TRUE)]) b <- boxplot(d.pizza$temperature, plot=FALSE) sort(b$out) # nice to find the corresponding rows d.pizza[Outlier(d.pizza$temperature, value=FALSE, na.rm=TRUE), ] # outliers for the each driver tapply(d.pizza$temperature, d.pizza$driver, Outlier, na.rm=TRUE) # the same as: boxplot(temperature ~ driver, d.pizza)$out