[R-pkg-devel] NAMESPACE issue and grDevices
murdoch@dunc@n @end|ng |rom gm@||@com
Sun Aug 25 00:45:00 CEST 2019
On 24/08/2019 10:36 a.m., Kevin Coombes wrote:
> I've been building a package and hit a NAMESPACE issue that took a while
> to resolve.
> My package implements a (new) generic function, and the method for a
> package in the class calls the "smoothScatter" function from the
> "graphics" package. I could build and install the package successfully,
> and when I used the generic function, it worked just fine.
> However, when I ran "R CMD check --as-cran", it threw an error from both
> the examples in man pages and a test script. Specifically, the error was
> "package KernSmooth not available". I eventually worked around this
> problem by changing the DESCRIPTION file to "IMPORT KernSmooth" (even
> though I didn't have to actually import anything in "NAMESPACE").
> The underlying issue appears to be that
> calls a non-exported function from "grDevices"
> which in turn calls an explicitly qualified function from "KernSmooth"
That looks like a bug in grDevices. If it suggests KernSmooth, it
should explicitly check whether it is installed before calling a
function from it.
> To complicate matters
> graphics IMPORTs grDevices
> grDevices only SUGGESTs KernSmooth.
> Since my package already IMPORTed the graphics package and had
> importFrom("graphics", "smoothScatter")
> in the NAMESPACE, I was surprised that I had to track back through the
> code to find this dependency and had to make it explicitly known within
> the interface to my package.
> Is there something else my package should do? Or should "grDevices"
> actually IMPORT "KernSmooth"?
It could import it, or it could put in a check and a workaround if it is
Now that you know about this bug, you could work around it by suggesting
KernSmooth, and not calling graphics::smoothScatter unless KernSmooth is
> R-package-devel using r-project.org mailing list
More information about the R-package-devel