Skip to content
Prev 77670 / 398502 Next

R: extracting elements in a matrix

... you can, for example

set.seed(13)
x<-matrix(rnorm(100),20,5)
lapply(split(x,col(x)),
       function(x){
         limit<-diff(quantile(x,c(.25,.75)))
         x[x>limit]
       })
output:
$"1"
[1] 1.775163 1.142526 1.229507 1.105144 1.396432
$"2"
[1] 1.836163
$"3"
[1] 1.590034 1.614479 1.408354 1.483691
$"4"
[1] 1.745427
$"5"
[1] 1.602120

Peter Wolf
Frank Schmid wrote: