Re: [R] Seeking help on Vectorize()

2010-06-03 Thread Duncan Murdoch
Megh Dal wrote: Dear falks, here I have written following function : fn - Vectorize(function(x = 1:3, y = 3:6) { x - matrix(x, nrow=1) y - matrix(y, ncol=1) dat - apply(x, 2, function(xx) { apply(y, 1, function(yy) {

[R] Seeking help on Vectorize()

2010-06-02 Thread Megh Dal
Dear falks, here I have written following function :   fn - Vectorize(function(x = 1:3, y = 3:6) {     x - matrix(x, nrow=1)     y - matrix(y, ncol=1)     dat - apply(x, 2, function(xx) {   apply(y, 1, function(yy) {  

Re: [R] Seeking help on Vectorize()

2010-06-02 Thread Joris Meys
Your arguments are not coming through. fn - function(x = 1:3, y = 3:6) { x - matrix(x, nrow=1) y - matrix(y, ncol=1) dat - apply(x, 2, function(xx) { apply(y, 1, function(yy) { return(xx + yy) } ) })

Re: [R] Seeking help on Vectorize()

2010-06-02 Thread Dennis Murphy
Hi: This is shorter: t(outer(x, y, '+')) [,1] [,2] [,3] [1,]456 [2,]567 [3,]678 [4,]789 [5,]89 10 HTH, Dennis On Wed, Jun 2, 2010 at 2:25 AM, Megh Dal megh700...@yahoo.com wrote: Dear falks, here I have written following function