you just need pmax() or pmin(), e.g., check this:
set.seed(123)
M1 <- matrix(rnorm(20), 4, 5)
M2 <- matrix(rnorm(20), 4, 5)
M3 <- matrix(rnorm(20), 4, 5)
M1; M2; M3
pmax(M1, M2, M3)
pmin(M1, M2, M3)
I hope it helps.
Best,
Dimitris
Diogo André Alagador wrote:
Dear all,
I have 3 matrices w
#how about this
A <- rnorm(10)
B <- rnorm(10)
C <- rnorm(10)
D <- data.frame(A,B,C)
apply(D, MARGIN=1, FUN=min)
On Thu, Nov 6, 2008 at 10:00 AM, Diogo André Alagador
<[EMAIL PROTECTED]> wrote:
> Dear all,
>
> I have 3 matrices with the same dimension, A,B,C and I would like to produce
> a matrix
Dear all,
I have 3 matrices with the same dimension, A,B,C and I would like to produce
a matrix D where in each position would retrieve the max(or min) value along
A,B,C taken from the same position.
I guess that apply functions should fit, but for matrices objects I am not
getting it.
thanks i
3 matches
Mail list logo