From m@echler @ending from @t@t@m@th@ethz@ch  Tue Oct  2 12:06:44 2018
From: m@echler @ending from @t@t@m@th@ethz@ch (Martin Maechler)
Date: Tue, 2 Oct 2018 12:06:44 +0200
Subject: [Rd] 
 Suggested Patch: Adding commas to list of packages after R CMD check
In-Reply-To: <5d8e2a34-4f71-6002-8e50-09fed8a74c97@gmail.com>
References: <7e1e0dfa-714f-aab8-1011-4d32fcb1c5e6@roswellpark.org>
 <5d8e2a34-4f71-6002-8e50-09fed8a74c97@gmail.com>
Message-ID: <23475.17204.995406.118998@stat.math.ethz.ch>

>>>>> Duncan Murdoch 
>>>>>     on Tue, 18 Sep 2018 16:23:47 -0400 writes:

> On 18/09/2018 2:16 PM, Marcel Ramos wrote:
> > Dear R-devs,
> > 
> > 
> > Scenario:
> > 
> > When checking a package via `R CMD check package_tar.ball`, required / suggested packages may be missing. R subsequently returns a list of packages that are missing (delimited by spaces).
> > 
> > Example:
> > 
> > ```
> > R CMD check glmSparseNet_0.99.13.tar.gz
> > * using log directory '/home/ubuntu/Bioconductor/glmSparseNet.Rcheck'
> > * using R Under development (unstable) (2018-06-06 r74855)
> > * using platform: x86_64-pc-linux-gnu (64-bit)
> > * using session charset: UTF-8
> > * checking for file 'glmSparseNet/DESCRIPTION' ... OK
> > * checking extension type ... Package
> > * this is package 'glmSparseNet' version '0.99.13'
> > * package encoding: UTF-8
> > * checking package namespace information ... OK
> > * checking package dependencies ... ERROR
> > Packages required but not available:
> >    'MultiAssayExperiment' 'glmnet' 'SummarizedExperiment' 'STRINGdb'
> >    'biomaRt' 'futile.logger' 'sparsebn' 'sparsebnUtils' 'forcats'
> >    'dplyr' 'readr' 'ggplot2' 'ggfortify' 'reshape2' 'rlang' 'loose.rock'
> > 
> > Packages suggested but not available:
> >    'testthat' 'knitr' 'rmarkdown' 'survcomp' 'pROC' 'devtools'
> >    'VennDiagram' 'BiocStyle' 'curatedTCGAData'
> > 
> > VignetteBuilder package required for checking but not installed: 'knitr'
> > 
> > The suggested packages are required for a complete check.
> > Checking can be attempted without them by setting the environment
> > variable _R_CHECK_FORCE_SUGGESTS_ to a false value.
> > 
> > See section 'The DESCRIPTION file' in the 'Writing R Extensions'
> > manual.
> > * DONE
> > 
> > Status: 1 ERROR
> > See
> >    '/home/ubuntu/Bioconductor/glmSparseNet.Rcheck/00check.log'
> > for details.
> > ```
> > 
> > 
> > Suggested Patch:
> > 
> > To return a list of missing dependencies delimited by a comma and a space (", ") so to make it easier for the user to copy and paste this list.
> > This would be especially helpful when the list of missing dependencies is extensive.

Your patch to *both* internal functions is small and in that
respect very nice, but it would effect really many of the R CMD
check messages.

I had been testing a modularized version of your proposed change
which only changes the defaults of  pretty_format2(.)   which
indeed is most often used in the context of listing package names.
In addition, I also did use regular quotes instead of the fancy
quotes there.

This has been committed to R-devel  (accidentally already
together with the \Sexpr{} related bug fix) in svn rev 75378, last Friday.


> This seems like a reasonable suggestion, considering how easy it is to do.
> 
> Another suggestion would be to (optionally) automatically install 
> missing dependencies.  I think the devtools::install_deps function will 
> do that.  (I don't use it, I have a homebrewed function for that purpose.)

> Duncan Murdoch

The new facilities (in R-devel only, by Luke Tierney) with NEWS entries

    ? Many ?package not found? errors are now signaled as errors of
      class packageNotFoundError.

    ? As an experimental feature, when loadNamespace() fails because
      the requested package is not available the error is initially
      signaled with a retry_loadNamespace restart available. This
      allows a calling handler to try to install the package and continue.

indeed should "easily" allow to go in that direction.

Thank you, Marcel and Duncan!

Martin

> 
> > 
> > 
> > Example output:
> > 
> > ```
> > R CMD check glmSparseNet_0.99.13.tar.gz
> > * using log directory '/home/ubuntu/Bioconductor/glmSparseNet.Rcheck'
> > * using R Under development (unstable) (2018-09-18 r75322)
> > * using platform: x86_64-pc-linux-gnu (64-bit)
> > * using session charset: UTF-8
> > * checking for file 'glmSparseNet/DESCRIPTION' ... OK
> > * checking extension type ... Package
> > * this is package 'glmSparseNet' version '0.99.13'
> > * package encoding: UTF-8
> > * checking package namespace information ... OK
> > * checking package dependencies ... ERROR
> > Packages required but not available:
> >    'MultiAssayExperiment', 'glmnet', 'SummarizedExperiment', 'STRINGdb',
> >    'biomaRt', 'futile.logger', 'sparsebn', 'sparsebnUtils', 'forcats',
> >    'dplyr', 'readr', 'ggplot2', 'ggfortify', 'reshape2', 'stringr',
> >    'rlang', 'loose.rock'
> > 
> > Packages suggested but not available:
> >    'testthat', 'knitr', 'rmarkdown', 'survcomp', 'pROC', 'devtools',
> >    'roxygen2', 'VennDiagram', 'BiocStyle', 'curatedTCGAData'
> > 
> > VignetteBuilder package required for checking but not installed: 'knitr'
> > 
> > The suggested packages are required for a complete check.
> > Checking can be attempted without them by setting the environment
> > variable _R_CHECK_FORCE_SUGGESTS_ to a false value.
> > 
> > See section 'The DESCRIPTION file' in the 'Writing R Extensions'
> > manual.
> > * DONE
> > 
> > Status: 1 ERROR
> > See
> >    '/home/ubuntu/Bioconductor/glmSparseNet.Rcheck/00check.log'
> > for details.
> > ```
> > 
> > 
> > svn diff:
> > 
> > 
> > Index: src/library/tools/R/QC.R
> > ===================================================================
> > --- src/library/tools/R/QC.R    (revision 75322)
> > +++ src/library/tools/R/QC.R    (working copy)
> > @@ -8536,13 +8536,13 @@
> >   .pretty_format <-
> >   function(x)
> >   {
> > -    strwrap(paste(sQuote(x), collapse = " "),
> > +    strwrap(paste(sQuote(x), collapse = ", "),
> >               indent = 2L, exdent = 2L)
> >   }
> >   .pretty_format2 <-
> >   function(msg, x)
> >   {
> > -    xx <- strwrap(paste(sQuote(x), collapse = " "), exdent = 2L)
> > +    xx <- strwrap(paste(sQuote(x), collapse = ", "), exdent = 2L)
> >       if (length(xx) > 1L || nchar(msg) + nchar(xx) + 1L > 75L)
> >           c(msg, .pretty_format(x))
> >       else paste(msg, xx)
> > 
> > 
> > 
> > PS. I would also advocate for setting `useFancyQuotes` to `FALSE` by default but it would be better to get more
> > input from the community.
> > 
> > Thanks!
> > 
> > 
> > Best regards,
> > 
> > Marcel
> > 
> > --
> > Marcel Ramos
> > Bioconductor Core Team
> > Roswell Park Comprehensive Care Center
> > Dept. of Biostatistics & Bioinformatics
> > Elm & Carlton Streets
> > Buffalo, New York 14263



[Rd] Suggested Patch: Adding commas to list of packages after R CMD check
Martin Maechler