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
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
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
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
4 matches
Mail list logo