I'm wrestling with the same issues, so this is the blind leading the
blind, but that usually prompts someone knowledgeable to say something
useful.
Roger D. Peng wrote:
>I have a question about what to do in the following situation (please bear
with
>the setup):
>
>Package A defines an S4 generic 'foo' and as well as S4 methods for
'foo' and has
>
>exportMethods("foo")
>
>in its NAMESPACE file.
>
>Package B defines another method for 'foo' for class "bar"
and has
>
>importFrom(A, "foo")
>exportMethods("foo")
>exportClasses("bar")
>
>in its NAMESPACE file. Should Package B also have Package A in the
'Depends:'
>field of the DESCRIPTION file or is it correct to import Package A only?
>
>
I thought it should only be necessary to import A in NAMESPACE and list
it in Imports in the DESCRPTION file, but I get warning messages if the
code in B does not require("A") in the .onLoad function. This in turn
means that A needs to be in the Depends line of DESCRIPTION.
>Finally, Package C has a single exported function named 'myfunc'
which needs to
>use the method for 'foo' defined in Package B, so its NAMESPACE file
has
>
>importFrom(A, "foo")
>importMethodsFrom(B, "foo")
>importClassesFrom(B, "bar")
>export("myfunc")
>
>Is this the correct thing to do?
>
>
I don't think you need the imports in this case, just the the export.
You do need B (and thus implicitly A) in the Depends line of DESCRIPTION.
>The error I get under this setup is that 'myfunc' cannot find the
method for
>'foo' defined in Package B when 'myfunc' calls 'foo'
on an object of class "bar".
>
>
I'm not sure why, but the one problem I have had is that when the syntax
of the NAMESPACE file is messed up, you only get warnings when to
require the package, but then you get errors when you try to use the
functions. Be sure to look back and see if you got warnings when you
require("B").
>If you've made it this far I'm already grateful! Any help with this
would be
>appreciated.
>
>
Thanks, you just saved me writing up the same questions.
>-roger
>
>
===================================================================================
La version fran?aise suit le texte anglais.
------------------------------------------------------------------------------------
This email may contain privileged and/or confidential inform...{{dropped}}