[R-pkg-devel] [Rd] NAMESPACE imports

Martin Maechler maechler at stat.math.ethz.ch
Mon Jun 22 13:26:35 CEST 2015

Dear Roger,

I'm diverting this to the newly appropriate R-package-devel  mailing list
see also http://www.r-project.org/mail.html .
I hope that's fine for you.

>>>>> Roger Koenker <rkoenker at illinois.edu>
>>>>>     on Mon, 22 Jun 2015 12:56:17 +0200 writes:

    >    I need some advice on how to resolve a warning in a revision of my
   > REBayes package.

   > At the moment the package Depends on SparseM and Matrix and does some
   > mildly exotic
   > coercion like this:
   > A <- as(as.matrix.csc(A),"dgCMatrix")
   > that converts a SparseM csr matrix A into a SparseM csc matrix and then
   > into a dgC Matrix. I suppose
   > that I could try to convert all of this sort of thing into pkg::fname
   > calls, but I dont relish the prospect.  

and IIUC, you should not do that ("::") typically, to the contrary.

   > Is there some other strategy?  Actually, to be honest, Im not entirely
   > sure how to do this conversion for the
   > above expression, so if this is the way to go, could someone explain
   > the right way to deal with the first as()?

The above is "fine" (well, I'm pretty sure it is suboptimal, and
you could more directly convert to a "dgCMatrix" ..)
in the sense of the package checks.

   > At the moment Im stuck with the following warning that I cant seem to
   > find a way around:
   > * checking whether package 'REBayes' can be installed ... WARNING
   > Found the following significant warnings:
   >   Warning: replacing previous import by 'SparseM::coerce' when loading
   > REBayes'

As alluded to above, you typically should not use have to use
such explicit "::" calls, but rather make sure -- via your
NAMESPACE file -- to import the corresponding functionality from
the correct places.

One "mistake" many package authors do is to say


for a host of packages instead specifically

  importFrom(pkg_1,  fun1, fun2, fun3)

As you are the maintainer of SparseM and I am of Matrix, we
should really e-talk in trying to resolve this.

Are you developing  REBayes "in public" (i.e. on R-forge,
github, bitorrent,  .. or another such public place), so I could
reproduce what you are seeing?

With best regards,

More information about the R-package-devel mailing list