hadley wickham
2004-Sep-09 17:48 UTC
[R] Confused about loading other packages from a package
In my package, I create a new method for plot with the following signature:
setMethod("plot", signature(x="marrayNorm",
y="formula"), plot.ma)
where marrayNorm is a class defined in the marray package. After
building and installing my package, I get the following warnings when
I load my package (with library(maVis)):
Warning messages:
1: In the method signature for function "plot", class
"marrayRaw" has
no current definition in: matchSignature(signature, fdef, where)
2: In the method signature for function "plot", class
"marrayRaw" has
no current definition in: matchSignature(signature, fdef, where)
(but everything appears to work ok regardless). I have tried
require(marray) both inside and outside of the .onLoad method.
I presume this is a caused by some difference in require depending on
whether or not it is within a package or not, as simply source()ing
the code gives no errors. What should I do? Ignore the warnings (or
turn them off somehow?) or use a different method of loading marray?
I'm also a bit confused about what is best practice for calling
methods in other packages - use namespace:::, use require, use
library, use the depends field in DESCRIPTION, so any advice here
would also be appreciated.
Thanks for you help,
Hadley
Roger D. Peng
2004-Sep-09 17:55 UTC
[R] Confused about loading other packages from a package
In R 2.0.0-to-be I think putting marray in the Depends: field will solve your problem. Otherwise, you might want to import the "marrayNorm" class in your NAMESPACE file. -roger hadley wickham wrote:> In my package, I create a new method for plot with the following signature: > > setMethod("plot", signature(x="marrayNorm", y="formula"), plot.ma) > > where marrayNorm is a class defined in the marray package. After > building and installing my package, I get the following warnings when > I load my package (with library(maVis)): > > Warning messages: > 1: In the method signature for function "plot", class "marrayRaw" has > no current definition in: matchSignature(signature, fdef, where) > 2: In the method signature for function "plot", class "marrayRaw" has > no current definition in: matchSignature(signature, fdef, where) > > (but everything appears to work ok regardless). I have tried > require(marray) both inside and outside of the .onLoad method. > > I presume this is a caused by some difference in require depending on > whether or not it is within a package or not, as simply source()ing > the code gives no errors. What should I do? Ignore the warnings (or > turn them off somehow?) or use a different method of loading marray? > I'm also a bit confused about what is best practice for calling > methods in other packages - use namespace:::, use require, use > library, use the depends field in DESCRIPTION, so any advice here > would also be appreciated. > > Thanks for you help, > > Hadley > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html >