> On 16 Aug 2017, at 11:11 , Berry Boessenkool <[email protected]>
> wrote:
>
>
> Hi,
>
>
> if a function in a package uses graphics::legend in the code, but does not
> import it in the namespace, shouldn't there be a warning in the check?
>
Er, no... Importing into a namespace is used to avoid the graphics:: qualifier.
This is conceptually different from having a dependency.
-pd
> There is not, also not on CRAN (one of my packages did this with
> stats::density).
>
> Should I report this to the CRAN team?
>
>
> Regards,
>
> Berry
>
>
> Here's a minimal working example using devtools:
>
> ### install.packages(c("devtools","roxygen2"))
>
> # create package structure ----
> getwd()
> devtools::create("testPack", description=list(License="GPL (>=2)"))
> setwd("testPack/")
> devtools::check() # everything is fine
>
> # add function ----
> cat("
> #' @title test function
> #' @description test function
> #' @export
> #' @importFrom graphics plot
> #' @examples testFun(1:6, col=2)
> #' @param x Values
> #' @param args List of arguments passed to legend
> #' @param \\dots Further arguments passed to plot
> #'
> testFun <- function(
> x,
> args=list(x='topright', legend=c('A','B'), lty=1),
> ...
> )
> {
> plot(x, ...)
> do.call(graphics::legend, args)
> }
> ", file="R/testFun.R")
>
> devtools::check() # no problems - even though I only import plot, not legend
> # same thing if I use graphics::legend directly (outside of do.call)
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [email protected] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel
--
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: [email protected] Priv: [email protected]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel