With the result of the 'cut' you can get a direct index for the values:
> x <- runif(20)
> x
[1] 0.26550866 0.37212390 0.57285336 0.90820779 0.20168193 0.89838968
0.94467527 0.66079779 0.62911404
[10] 0.06178627 0.20597457 0.17655675 0.68702285 0.38410372 0.76984142
0.49769924 0.71761851 0.991906
In this case I only get three values back. My intention was to get every
value between 10% and 90% i.e. let's say i have a matrix
1 2 3 4
5 6 7 8
9 10 11 12
i only want the values above 10% and under 90%.
Maybe i should try it with a loop.
--
View this message in context:
http://r.789695.n4.
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 wrote:
>
> I have got a matrix with 100 values.
> Is there a easy w
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-Ma
4 matches
Mail list logo