Skip to content
Prev 46484 / 63424 Next

Correct NAMESPACE approach when writing an S3 method for a generic in another package

I'm not familiar enough with S4 to know what is going on there. With
S3 methods, the package that defines the generic needs to be loaded
and attached, otherwise you can't do

foo(bar)

when

foo.myclass(bar)

is what you want to be called and you export that method from your
package. Calling `foo()` will result in an error. As long as the
package containing the definition of the generic is not attached,
there is no function `foo()` and hence the user gets an error.

G
On 26 August 2013 13:12, Paul Gilbert <pgilbert902 at gmail.com> wrote: