Skip to content
Prev 15883 / 63461 Next

Overloading methods in R

Naming conflicts, may be the problem. You have that generic in your package,
but I might, without know about yours, and I write 

 setGeneric("testFun", function(x, ...))

in my package, and then a third person that we don't know of, is loading
both of our packages. Ouch! Indeed, this do happens. 

I would be ok with the above, if everyone agreed to use 'object' as the
first argument - but then you have plot(x, ...) and so on. Also, how should
you treat default functions not taking any arguments, e.g. traceback()?
Until then I stick with testFun <- function(...) UseMethod("foo") whenever
possible.

Cheers

Henrik