Excellent! Thank you!
ben
On Wed, Oct 5, 2011 at 9:18 PM, Dennis Murphy wrote:
> Hi:
>
> Here's one way:
>
> m <- matrix(rpois(100, 8), nrow = 5)
> f <- function(x) {
>q <- quantile(x, c(0.1, 0.9), na.rm = TRUE)
>c(sum(x < q[1]), sum(x > q[2]))
>}
>
> t(apply(m, 1, f))
>
> HTH,
> De
Hi:
Here's one way:
m <- matrix(rpois(100, 8), nrow = 5)
f <- function(x) {
q <- quantile(x, c(0.1, 0.9), na.rm = TRUE)
c(sum(x < q[1]), sum(x > q[2]))
}
t(apply(m, 1, f))
HTH,
Dennis
On Wed, Oct 5, 2011 at 8:11 PM, Ben qant wrote:
> Hello,
>
> I'm trying to get the count of value
Hello,
I'm trying to get the count of values in each row that are above and below
quantile thresholds. Thanks!
Example:
> x = matrix(1:30,5,6)
> x
[,1] [,2] [,3] [,4] [,5] [,6]
[1,]16 11 16 21 26
[2,]27 12 17 22 27
[3,]38 13 18 23 28
[4,]4
3 matches
Mail list logo