[R] Passing arguments between S4 methods fails within a function:bug? example with raster package.

2010-08-26 Thread Joris Meys
Dear all, This problem came up initially while debugging a function, but it seems to be a more general problem of R. I hope I'm wrong, but I can't find another explanation. Let me illustrate with the raster package. For an object RasterLayer (which inherits from Raster), there is a method

Re: [R] Passing arguments between S4 methods fails within a function:bug? example with raster package.

2010-08-26 Thread Niels Richard Hansen
Joris, I looked at the problem. Here is a minimal example reproducing the error setGeneric(myplus,function(x,y,...) standardGeneric(myplus)) setMethod(myplus,c(x=numeric,y=numeric), function(x,y,z=0) x+y+z ) setMethod(myplus,c(x=numeric,y=list), function(x,y,...)

Re: [R] Passing arguments between S4 methods fails within a function:bug? example with raster package.

2010-08-26 Thread Martin Morgan
On 8/26/2010 8:43 AM, Niels Richard Hansen wrote: setGeneric(myplus,function(x,y,...) standardGeneric(myplus)) setMethod(myplus,c(x=numeric,y=numeric), function(x,y,z=0) x+y+z ) setMethod(myplus,c(x=numeric,y=list), function(x,y,...) callGeneric(x,unlist(y),...)

Re: [R] Passing arguments between S4 methods fails within a function:bug? example with raster package.

2010-08-26 Thread Niels Richard Hansen
On 26/08/10 18.42, Martin Morgan wrote: On 8/26/2010 8:43 AM, Niels Richard Hansen wrote: setGeneric(myplus,function(x,y,...) standardGeneric(myplus)) setMethod(myplus,c(x=numeric,y=numeric), function(x,y,z=0) x+y+z ) setMethod(myplus,c(x=numeric,y=list), function(x,y,...)