Thanks Pikal for your reply I want element wise summation. If t is a vector of 5, v is a matrix of 5*5 then I want the answer to be a matrix of 5*5 by multiplying each element in t (t_j) by each vector in v (v_j). Dina Petr Pikal wrote:
Hi you shall probably to be more specific tj<-rnorm(5) vj<-matrix(25,5,5) sum(tj*vj) [1] 149.2977 gives you an answer but maybe not the answer you want. HTH Petr On 3 Oct 2006 at 8:58, Dina Said wrote: Date sent: Tue, 03 Oct 2006 08:58:15 +0200 From: Dina Said [1]<[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Subject: [R] Summation in R Hello! Maybe this is a trivial question as I'm still a new baby in R but I wish that u will help me. I want to calculate the following U= sum (t_j*v_j) where t_j is a vector and v_j is the matrix Thanks Dina ______________________________________________ [EMAIL PROTECTED] mailing list [4]https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide [5]http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Petr Pikal [EMAIL PROTECTED] References 1. mailto:[EMAIL PROTECTED] 2. mailto:[email protected] 3. mailto:[email protected] 4. https://stat.ethz.ch/mailman/listinfo/r-help 5. http://www.R-project.org/posting-guide.html 6. mailto:[EMAIL PROTECTED] ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
