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]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.