[R] transition from depends to imports

Duncan Murdoch murdoch.duncan at gmail.com
Fri May 9 23:42:39 CEST 2014


On 09/05/2014, 5:39 PM, Andreas Leha wrote:
> Hi Duncan,
>
> Thank you for your follow-up and fast response!
>
> Duncan Murdoch <murdoch.duncan at gmail.com> writes:
>
>> 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
>
> As it seems, the version I use(d) depends on modeltools.
>
> ,----
> | > packageDescription("coin")
> | Package: coin
> | Title: Conditional Inference Procedures in a Permutation Test Framework
> | Date: 2013-04-26
> | Version: 1.0-22
> | Author: Torsten Hothorn, Kurt Hornik, Mark A. van de Wiel and Achim
> |         Zeileis
> | Maintainer: Torsten Hothorn <Torsten.Hothorn at R-project.org>
> | Description: Conditional inference procedures for the general
> |         independence problem including two-sample, K-sample
> |         (non-parametric ANOVA), correlation, censored, ordered and
> |         multivariate problems.
> | Depends: R (>= 2.2.0), methods, survival, mvtnorm (>= 0.8-0),
> |         modeltools (>= 0.2-9)
> | Suggests: multcomp, xtable, e1071, vcd
> | Enhances: Biobase
> | LazyLoad: yes
> | LazyData: yes
> | License: GPL-2
> | Packaged: 2013-04-26 12:33:15 UTC; hothorn
> | NeedsCompilation: yes
> | Repository: CRAN
> | Date/Publication: 2013-04-26 15:27:04
> | Built: R 3.0.1; x86_64-pc-linux-gnu; 2013-05-29 16:07:42 UTC; unix
> |
> | -- File: /usr/lib/R/site-library/coin/Meta/package.rds
> `----
>
> I can confirm that updating coin (to version 1.1-0) did resolve my
> problem.  Thank you very much!
>
>
> This leads to the follow-up question:  How would I have correctly dealt
> with this situation if my dependency ('coin') had not been updated?

I think the only workaround would be for you to say your package Depends 
on modeltools.  It's really a coin issue, not yours, and the right 
people fixed it.

Duncan Murdoch



More information about the R-help mailing list