Re: [R] Multiplying each row of a big matrix with a vector

2008-01-30 Thread Attiglah, Mama
I understood that you only need to multiply each row of Ret by the vector Pos but it seems that you would like to sum the resulting vector element in order to have a vector of length 500. That is merely the matrix multiplication in R!!! i.e. Ret %*% Pos. Am I getting the question wrong? Mama

Re: [R] Multiplying each row of a big matrix with a vector

2008-01-30 Thread Megh Dal
Yes definitely it is just matrix multiplication. However I was interested why those code going wrong. Attiglah, Mama [EMAIL PROTECTED] wrote: I understood that you only need to multiply each row of Ret by the vector Pos but it seems that you would like to sum the resulting vector element in

[R] Multiplying each row of a big matrix with a vector

2008-01-29 Thread Megh Dal
I have a big matrix 'ret'. I want to multiply each row of it with a 2nd vector 'pos', resulting result, I want to save in a vector named 'port'. I wrote following code: pos [1] 2593419 2130220 6198197 1673888 198 1784732 2052120 -7490228 -5275000 dim(ret) [1] 500 9

Re: [R] Multiplying each row of a big matrix with a vector

2008-01-29 Thread Bill.Venables
port - as.vector(ret %*% port) should do it. Bill Venables -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Megh Dal Sent: Wednesday, 30 January 2008 5:20 PM To: [EMAIL PROTECTED] Subject: [R] Multiplying each row of a big matrix with a vector I have