Re: [R] addition of matrix

2008-02-19 Thread Gabor Grothendieck
This is your original problem: f <- function(x, y) as.vector(outer(x, y, "/")) mapply(f, as.data.frame(t(X)), as.data.frame(t(Y))) so just replace "/" with whatever function of two variables you like. See ?outer and be sure your function replacing "/" is vectorizable as noted there. On Feb 19,

Re: [R] addition of matrix

2008-02-19 Thread Yinghai Deng
PROTECTED] Behalf Of Marlin Keith Cox Sent: February 19, 2008 2:07 PM To: r-help@r-project.org Subject: [R] addition of matrix Thank you ahead of time for help with this. I have two matrices X [,1] [,2] [,3] [,4] [,5] [,6] [1,] 660 693.00 726.0 759.00 792.0 825.00 [2,] 548 575.40 602

[R] addition of matrix

2008-02-19 Thread Marlin Keith Cox
Thank you ahead of time for help with this. I have two matrices X [,1] [,2] [,3] [,4] [,5] [,6] [1,] 660 693.00 726.0 759.00 792.0 825.00 [2,] 548 575.40 602.8 630.20 657.6 685.00 [3,] 676 709.80 743.6 777.40 811.2 845.00 [4,] 763 801.15 839.3 877.45 915.6 953.75 [5,] 768 80