Michael

(Several of us are struggling with these changes, so my comments are from the newly initiated point of view, rather than the fully knowledgeable.)

On 13-09-12 09:38 AM, Michael Friendly wrote:
I received the following email note re: the vcdExtra package

A vcd update has shown that packages TIMP and vcdExtra are not
declaring their dependence on colorspace/MASS: see

http://cran.r-project.org/web/checks/check_results_vcdExtra.html
But, I can't see what to do to avoid this, nor understand what has
changed in R devel.

Lots in this respect.

Sure enough, CRAN now reports errors in examples using MASS::loglm(),
using R Under development (unstable) (2013-09-11 r63906)

 > Caesar.mod0 <- loglm(~Infection + (Risk*Antibiotics*Planned),
data=Caesar)
Error: could not find function "loglm"

In DESCRIPTION I have
Depends: R (>= 2.10), vcd, gnm (>= 1.0.3)

The "modern" way of thinking about this is that the Depends line should not have much in it, only things from other packages that you want directly available to the user. (There are a few other exceptions necessary for packages that have not themselves embraced the "modern" way.) Since you may want users of vcdExtra to automatically have access to functions in vcd, without needing to execute library(vcd), this classifies as one of the official exceptions and you probably want cvd in the Depends line. However, chances are that gnm should be in Imports:. If vcd is in the Depends line then it is automatically attached and your examples do not need library(vcd) or requires(vcd).

The Note

  Unexported object imported by a ‘:::’ call: ‘vcd:::rootogram.default’

is harder to decide how to deal with. (This is sill just a note, but it looks to me like a note that will soon become a warning or error.) The simple solution is to export rootogram.default from vcd, but that exposes it to all users, and really you may just want to expose it to packages like vcdExtra. There was some recent discussion about this on R-devel. I suggested one possibility would be some sort of limited export. Since that was a suggestion that required work by someone else, it probably went the same place as most of those suggestion do. The solution I have adopted for the main case where this causes me problems is to split the classes, generics, and methods into one package, and the user functions into another. For example, if you have rootogram.default in a package called vcdClasses and exported it, then both vcd and vcdExtra can import it, but if it is not in their Depends line then it will not be visible to a user that executes library(vcd) or library(vcdExtra).

Beware that there is currently a small gotcha if the generics are S3, which was discussed recently and a patch submitted by Henrik Bengtsson (See Re: [Rd] "False" warning on "replacing previous import" when re-exporting identical object .)


Although there has been much moaning about these changes, including my own, I think the general logic is a real improvement. The way I think of it, the namespace imports for a package provide the equivalent of a search path for functions in the package, which is not changed by what packages a user or other packages attach or import. Thus a package developer has much more certain control over where the functions used by the package will come from. This is a trade-off for safety rather than convenience, thus the moaning. I am a complete newbie on this, but there seems to be a pretty good unofficial description at http://obeautifulcode.com/R/How-R-Searches-And-Finds-Stuff/.

Suggests:
ca,gmodels,Fahrmeir,effects,VGAM,plyr,rgl,lmtest,MASS,nnet,ggplot2,Sleuth2,car

If it is only in Suggests you can refer to it in the example by MASS::loglm(), or require(MASS)/library(MASS). (I might have that wrong, at least one works but I'm not certain of both.)


and the vcd DESCRIPTION has

Depends: R (>= 2.4.0), grid, stats
Suggests: KernSmooth, mvtnorm, kernlab, HSAUR, coin
Imports: utils, MASS, grDevices, colorspace

Probably grid and stats should be in Imports.


so, in an R 3.0.0 console, library(vcdExtra) loads vcd and its
dependencies:

 > library(vcdExtra)
Loading required package: vcd
Loading required package: MASS
Loading required package: grid
Loading required package: colorspace
Loading required package: gnm
Warning messages:
1: package ‘vcd’ was built under R version 3.0.1
2: package ‘MASS’ was built under R version 3.0.1
 >

Note: these CRAN errors do not occur on R-Forge, using R version 3.0.1

Are you actually getting anything to build on R-forge? All my packages have been stuck for a couple of weeks, as have many others.

Paul

Patched (2013-08-21 r63645)
and the latest devel version (0.5-11) of vcdExtra.

-Michael


______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to