Re: [R] Multiplying a list of matrices with a vector

2011-09-29 Thread Mendolia, Franco
Thank you! Franco From: David Winsemius [dwinsem...@comcast.net] Sent: Thursday, September 29, 2011 8:09 AM To: R. Michael Weylandt Cc: Mendolia, Franco; r-help@r-project.org Subject: Re: [R] Multiplying a list of matrices with a vector On Sep 28, 2011

Re: [R] Multiplying a list of matrices with a vector

2011-09-29 Thread David Winsemius
On Sep 28, 2011, at 6:26 PM, R. Michael Weylandt wrote: Untested: mapply('*', LL, vec) Those should be backticks but I can't type them on my phone Actually mapply does not require backticks since it is expecting its functions to be quoted anyway, but it didn't seem to work as you (and I

Re: [R] Multiplying a list of matrices with a vector

2011-09-28 Thread R. Michael Weylandt
Untested: mapply('*', LL, vec) Those should be backticks but I can't type them on my phone Michael On Sep 28, 2011, at 6:04 PM, "Mendolia, Franco" wrote: > Hi all! > > I have a list of matrices and I want to multiply the ith element of the list > with the ith element of a another vector. Th

[R] Multiplying a list of matrices with a vector

2011-09-28 Thread Mendolia, Franco
Hi all! I have a list of matrices and I want to multiply the ith element of the list with the ith element of a another vector. That is, > LL <- list(A=diag(3),B=diag(3),C=diag(3)) > vec <- 1:3 > for(i in 1:3) + { + LL[[i]] <- LL[[i]]*vec[i] + } > LL $A [,1] [,2] [,3] [1,]100 [