[R] transition from depends to imports

Duncan Murdoch murdoch.duncan at gmail.com
Fri May 9 23:22:29 CEST 2014


On 09/05/2014, 5:08 PM, Andreas Leha wrote:
> Hi all,
>
> I am having trouble to do a particular transition from depends to
> imports in one of my packages.
>
> This packages uses 'wilcoxsign_test' from the 'coin' package.  And this
> is the only function from the coin package that it uses (directly).
>
> (Everything works fine, as long as my package depends on the coin
> package.)
>
> My guess was, that I would need to only import that function from the
> coin package. (I.e. to move the coin package from Depends
> to Imports in the DESCRIPTION and in the NAMESPACE do
> 'importFrom(coin,wilcoxsign_test)'.)
>
> But then, calling wilcoxsign_test leads to this error:
> ,----
> | Error in formula2data(formula, data, subset, frame = parent.frame(), ...) :
> |   could not find function "ModelEnvFormula"
> `----
>
> Now, formula2data is an unexported function in the coin package and
> ModelEnvFormula is a (exported) function in modeltools.
>
> So, I tried to import ModelEnvFormula from modeltools -- no avail.
> And I tried to import formula2data from coin -- not possible
> And I tried to import the whole coin package -- no avail.
>
> So, here is the question:  How do I import 'wilcoxsign_test' from the
> coin package in a way, that it is usable?
>

Which version of the packages are you using?  The current version of 
coin imports ModelEnvFormula from modeltools, so it should be able to 
find that function.

Duncan Murdoch



More information about the R-help mailing list