s-news
[Top] [All Lists]

Row/colonne operations

To: "Snews (E-mail)" <s-news@lists.biostat.wustl.edu>
Subject: Row/colonne operations
From: "Alain Yamakana" <alain.yamakana@rogers.com>
Date: Mon, 1 Mar 2004 19:41:25 -0500
Here is another matrix operation question. 
> M <- array(1:24, dim = c(6, 4))
> M
     [,1] [,2] [,3] [,4]
[1,]    1    7   13   19
[2,]    2    8   14   20
[3,]    3    9   15   21
[4,]    4   10   16   22
[5,]    5   11   17   23
[6,]    6   12   18   24
> M[4,]+M[5,]
[1]  9 21 33 45
> 
I expect 

      [,1] [,2] [,3] [,4]
[1,]    1    7   13   19
[2,]    2    8   14   20
[3,]    3    9   15   21
[4,]    9   21   33  45
[5,]    6   12   18  24

Any suggestion please.

<Prev in Thread] Current Thread [Next in Thread>