Displaying 1 result from an estimated 1 matches for "mmpli".
Did you mean:
ampli
2010 Sep 06
3
Aggregate certain rows in a matrix
Hi,
I have a matrix that looks like this
a <- c(1,1,1,1,2,2,3,3,3,3)
b <- c(2,2,2,3,4,4,4,5,5,6)
c <- c(1,2,3,4,5,6,7,8,9,10)
M <- matrix(nr=10,nc=3)
M[,1] <- a
M[,2] <- b
M[,3] <- c
> M
[,1] [,2] [,3]
[1,] 1 2 1
[2,] 1 2 2
[3,] 1 2 3
[4,] 1 3 4
[5,] 2 4 5
[6,] 2 4 6
[7,] 3 4 7