[Rd] Visibility of methods in different namespaces

From: Thomas Etheber <etheber_at_gmx.de>
Date: Thu, 22 Jul 2010 13:56:26 +0200

Hey folks,

I read plenty of material and started to write some new R-packages, but actually I am looking for a solution of the following problem. Perhaps it's a beginners question for creating packages, but I wasn't able to track it down yet. Hopefully you can provide me with a solution or at least some adequate readings.

I have a package say it's called "AAA" with an S4-object say it's called "aObject". On the other hand I have a package "BBB" with an S4-object called "bObject".
Both objects want to provide the same method to outside users, the method is called "calculateModel" and they were implemented in the package using the following S3 notation:

Package AAA:

calculateModel <- function( object, ...) { UseMethod( "calculateModel") } calculateModel.aObject <- function( object, ..., someAdditionalParameters ) { bla bla }

Package BBB:

calculateModel <- function( object, ...) { UseMethod( "calculateModel") } calculateModel.bObject <- function( object, ..., someAdditionalParameters ) { bla bla }

In the NAMESPACE file of package AAA and package BBB, I registered the methods using:

Package AAA:

S3method( "calculateModel", "aObject" )
export( "calculateModel" )

Package BBB:

S3method( "calculateModel", "bObject" )
export( "calculateModel" )

Everything works fine, when I load only one of the packages. But if I load both packages together, one of the calculateModel methods disappears and is no longer visible, which results in an error.

What am I missing?


R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Thu 22 Jul 2010 - 12:08:08 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 22 Jul 2010 - 21:00:18 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive