Re: [R] Basic vector operations was: Function to approximate complex integral

2006-04-19 Thread Marc Schwartz (via MN)
On Wed, 2006-04-19 at 15:25 -0400, Doran, Harold wrote: > Dear List > > I apologize for the multiple postings. After being in the weeds on this > problem for a while I think my original post may have been a little > cryptic. I think I can be clearer. Essentially, I need the following > > a <- c(2

Re: [R] Basic vector operations was: Function to approximate complex integral

2006-04-19 Thread Sebastian Luque
"Doran, Harold" <[EMAIL PROTECTED]> wrote: [...] > a <- c(2,3) > b <- c(4,5,6) > (2*4) + (2*5) + (2*6) + (3*4) + (3*5) +(3*6) > But I do not know of a built in function that would do this. Any > suggestions? How about: sum(a %o% b) ?%o% Cheers, -- Seb

Re: [R] Basic vector operations was: Function to approximate complex integral

2006-04-19 Thread jim holtman
You can always write your own function that will take the values, multiply and then sum them: > a <- c(2,3) > b <- c(4,5,6) > total <- 0 > for (i in a) total <- sum(total, i * b) > total [1] 75 > On 4/19/06, Doran, Harold <[EMAIL PROTECTED]> wrote: > > Dear List > > I apologize for the multiple

[R] Basic vector operations was: Function to approximate complex integral

2006-04-19 Thread Doran, Harold
Dear List I apologize for the multiple postings. After being in the weeds on this problem for a while I think my original post may have been a little cryptic. I think I can be clearer. Essentially, I need the following a <- c(2,3) b <- c(4,5,6) (2*4) + (2*5) + (2*6) + (3*4) + (3*5) +(3*6) But I