[R] Cutting Matrix

jim holtman
2010-12-06T18:26:40Z

You can use quantile and cut:

> x <- runif(1000)
> x.cut <- cut(x, c(-Inf, quantile(x, prob=c(.1, .9)), Inf),
labels=c('lo','mid','hi'))
> table(x.cut)
x.cut
 lo mid  hi
100 800 100
>


On Mon, Dec 6, 2010 at 12:53 PM, Marty_H <church01 at alpenjodel.de>
wrote:
>
> I have got a matrix with 100 values.
> Is there a easy way to cut the upper 10% (every value which is above 90%)
> and the lower 10% of my matrix-values away and create a new matrix with all
> the rest.
>
> Thx for your help
>
> Marty
> --
> View this message in context:
http://r.789695.n4.nabble.com/Cutting-Matrix-tp3074970p3074970.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> 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.
>



--
Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?