1

I am making an R package and I am trying to get the NAMESPACE file right. In general my question is: Say that I want to use (import), in my package, two different functions but with the same name, in turn exported by two different packages. How can this be specified in the NAMESPACE file and in the code?

Specifically I get the following warning:

Creating a generic function for 'boxplot' from package 'graphics' in package 'affyPLM'

Creating a generic function for 'hist' from package 'graphics' in package 'affyPLM'

I am guessing that this means that the boxplot and hist methods for the fitPLM class are replaced by ones from graphics? I also import affy but this does not give a warning, although there is a boxplot method for the AffyBatch class. The thing is, I only use importFrom(affyPLM, fitPLM).

How can I get rid of the warning? I have struggled to find any answer on the web but without success, so if you have any idea or tip, please help me!

Community
  • 1
  • 1
  • This is coming from affyPLM, rather than your package, so there is nothing to be done about it. It's not a warning but a message. affyPLM says `setMethod(boxplot, ...)` and this causes S4 to create a generic for `boxplot`; you can see this yourself in a fresh R session with just `setClass("A"); setMethod(boxplot, "A", function(x, ...) {})`. It's not clear that this is the question you meant to ask? – Martin Morgan Nov 14 '11 at 15:13
  • Ok, thanks, this helped me. I agree that it is not really clear in my question, mainly because I did not understand the concept. So basically, affyPLM is just creating a generic for `boxplot` which will be used if the argument of boxplot is of class PLMset? And the message is simply giving this information? Why is this message appearing when I do `library(myPkg)` and not when I do `library(affyPLM)`? – user1045683 Nov 14 '11 at 22:04
  • Yes you're right about the creating a generic / dispatching when the argument is PLMset, and the message giving you that information. As for 'why', I think the answer is 'because', i.e., that's the way it's implemented. It's worth a shout-out to R-devel with a simpler example if at all possible. – Martin Morgan Nov 14 '11 at 23:56

0 Answers0