Hi,
I define a generic function that has many parameters (~20). I then want to
define methods for the generic function with setMethod. The default behavior
for setGeneric is to allow dispatching on any argument in the def function,
expect ...
For example,
# define a generic function
setGeneric("test",
useAsDefault=FALSE,
function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,
o,p,q,r,s,t,u,v,w,x,y,z,...){
standardGeneric("test")
}
)
# If I define a method for an argument early in the list of arguments, then
there is no problem...
setMethod("test",signature(i="character"),
function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,
o,p,q,r,s,t,u,v,w,x,y,z,...){
}
)
# However, if I define an argument late in list of arguments, R hangs and
allocates itself huge amounts of memory
# (>500MB in a matter of seconds)...
setMethod("test",signature(z="character"),
function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,
o,p,q,r,s,t,u,v,w,x,y,z,...){
}
)
# Is this a bug? I did read the help and did not notice a limit on the
number of formal arguments for which S4 method
# dispatching will work. A work around is to specify the signature in
setGeneric...
setGeneric("test",
signature="z",
useAsDefault=FALSE,
function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,
o,p,q,r,s,t,u,v,w,x,y,z,...){
standardGeneric("test")
}
)
setMethod("test",signature(z="character"),
function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,
o,p,q,r,s,t,u,v,w,x,y,z,...){
}
)
Thanks for any help you can provide,
Steve
[[alternative HTML version deleted]]