R vectorデータから外れ値を除外する方法が紹介されています

Reference – https://twitter.com/R_Programming/status/638931381536485376
> set.seed(10)

> x<-c(rnorm(5),10,-5)

> x
[1]  0.01874617 -0.18425254 -1.37133055 -0.59916772  0.29454513 10.00000000 -5.00000000

> y<-x[!x %in% boxplot.stats(x,coef=1.5, do.conf=TRUE,do.out=TRUE)$out]

> y
[1]  0.01874617 -0.18425254 -1.37133055 -0.59916772  0.29454513

> boxplot.stats(x,coef=1.5, do.conf=TRUE,do.out=TRUE)
$stats
[1] -1.3713305 -0.9852491 -0.1842525  0.1566456  0.2945451

$n
[1] 7

$conf
[1] -0.8661737  0.4976686

$out
[1] 10 -5