[R] outliers in Box Plot

Giorgio Garziano giorgio.garziano at ericsson.com
Tue Sep 6 15:09:36 CEST 2016


Hi Rosa,

you may take advantage of the extremevalues package.

https://cran.r-project.org/web/packages/extremevalues/extremevalues.pdf

An example:

set.seed(1023)
v3 <- c(rnorm(100, 0, 0.2), rnorm(5, 4, 0.1), rnorm(5, -4, 0.1))
v4 <- sample(v3, length(v3))
nam <- as.character(1:length(v4))
df <- data.frame(names = nam, values = v4)


library(extremevalues)

res <- getOutliersI(as.vector(df[,"values"]), FLim=c(0.001, 0.999), distribution="normal")

# indexes where outliers are located
res$iLeft
res$iRight

outliers_idx <- c(res$iLeft, res$iRight)

df_outliers <- data.frame(index= outliers_idx, values = df[outliers_idx,"values"])
df_outliers

outlierPlot(df[,"values"], L=res)


--

Best

GG



	[[alternative HTML version deleted]]



More information about the R-help mailing list