s-news
[Top] [All Lists]

[S] Matrix Operation

To: S-news@wubios.wustl.edu
Subject: [S] Matrix Operation
From: Fang Chen <fangc@stat.cmu.edu>
Date: Wed, 26 Jan 2000 21:04:09 -0500 (EST)
In-reply-to: <AFD78192EC49D311BFAE00902798AB8F03BFDC@jupiter.sc.arbitrade.com>
Sender: owner-s-news@wubios.wustl.edu

Hello all:

I need help on how to better perform a matrix operation. 

Data_matrix(c(2,3,5,6,3,4,5,7,8,10,11,13,4,5,6),3,5)
Row.Index_matrix(c(1,2,4,2,3,5,3,4,5),3,3,byrow=T)
> Data
     [,1] [,2] [,3] [,4] [,5] 
[1,]    2    6    5   10    4
[2,]    3    3    7   11    5
[3,]    5    4    8   13    6
> Row.Index
     [,1] [,2] [,3] 
[1,]    1    2    4
[2,]    2    3    5
[3,]    3    4    5

And I hope to pick out entries in Data, row by row, according to
Row.Index,
i.e. I want my final matrix looks like:
     [,1] [,2] [,3] 
[1,]    2    6   10
[2,]    3    7    5
[3,]    8   13    6

Thanks in advance.

Fang

-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu.  To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message:  unsubscribe s-news

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