Re: [R] Multiply each column of array by vector component

2007-11-15 Thread Greg Snow
0:50 AM > To: r-help@r-project.org > Subject: [R] Multiply each column of array by vector component > > Hi, > > I've got an array, say with i,jth entry = A_ij, and a vector, > say with jth entry= v_j. I would like to multiply each column > of the array by the corr

Re: [R] Multiply each column of array by vector component

2007-11-15 Thread Marc Schwartz
On Thu, 2007-11-15 at 17:50 +, [EMAIL PROTECTED] wrote: > Hi, > > I've got an array, say with i,jth entry = A_ij, and a vector, say with jth > entry= v_j. I would like to multiply each column of the array by the > corresponding vector component, i,e. find the array with i,jth entry > > A_ij

Re: [R] Multiply each column of array by vector component

2007-11-15 Thread Henrique Dallazuanna
If i understand your question, you can do: x <- matrix(1:10, 2) y <- sample(10,5) apply(x, 1, function(.x)mapply(y, .x, FUN="*")) On 15/11/2007, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi, > > I've got an array, say with i,jth entry = A_ij, and a vector, say with jth > entry= v_j. I would

Re: [R] Multiply each column of array by vector component

2007-11-15 Thread Benilton Carvalho
?sweep b On Nov 15, 2007, at 12:50 PM, [EMAIL PROTECTED] wrote: > Hi, > > I've got an array, say with i,jth entry = A_ij, and a vector, say with > jth > entry= v_j. I would like to multiply each column of the array by the > corresponding vector component, i,e. find the array with i,jth entry >

Re: [R] Multiply each column of array by vector component

2007-11-15 Thread Gabor Grothendieck
On Nov 15, 2007 12:50 PM, <[EMAIL PROTECTED]> wrote: > Hi, > > I've got an array, say with i,jth entry = A_ij, and a vector, say with jth > entry= v_j. I would like to multiply each column of the array by the > corresponding vector component, i,e. find the array with i,jth entry > > A_ij * v_j > >

[R] Multiply each column of array by vector component

2007-11-15 Thread M . T . Charemza
Hi, I've got an array, say with i,jth entry = A_ij, and a vector, say with jth entry= v_j. I would like to multiply each column of the array by the corresponding vector component, i,e. find the array with i,jth entry A_ij * v_j This seems so basic but I can't figure out how to do it without a lo