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

2018-09-18 Thread Marcel Ramos
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.


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


This email message may contain legally privileged and/or confidential 
information.  If you are not the intended recipient(s), or the employee or 
agent responsible for the delivery of this message to the intended 
recipient(s), you are hereby notified that any disclosure, copying, 
distribution, or use of this email message is prohibited.  If you have received 
this message in error, please notify the sender immediately by e-mail and 
delete this email message from your computer. Thank you.
[[alternative HTML version deleted]]

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


[Rd] Suggested Patch: Library returns matching installed packages when typo present

2019-06-20 Thread Marcel Ramos
Dear R-core devs,

I hope this email finds you well.

Please see the proposed patch to R-devel below:

Scenario:

When loading a package using `library`, a package may not be found if the cases 
are not matching:

```
> library(ORG.Hs.eg.db)
 Error in library(ORG.Hs.eg.db) :
  there is no package called 'ORG.Hs.eg.db'
```


Suggested Patch:

Returns a message matching what `install.packages` returns in such situations:

```
> library("ORG.Hs.eg.db")
 Error in library("ORG.Hs.eg.db") :
   there is no package called 'ORG.Hs.eg.db'
 In addition: Warning message:
 Perhaps you meant 'org.Hs.eg.db' ?
```

This patch will be helpful with 'fat-finger' typos. It will match a package
called with `library` against installed packages.


svn diff:

Index: src/library/base/R/library.R
===
--- src/library/base/R/library.R(revision 76727)
+++ src/library/base/R/library.R(working copy)
@@ -300,8 +300,13 @@
 pkgpath <- find.package(package, lib.loc, quiet = TRUE,
 verbose = verbose)
 if(length(pkgpath) == 0L) {
-if(length(lib.loc) && !logical.return)
+if(length(lib.loc) && !logical.return) {
+allpkgs <- .packages(TRUE, lib.loc)
+if (!is.na(w <- match(tolower(package), tolower(allpkgs
+warning(sprintf("Perhaps you meant %s ?",
+sQuote(allpkgs[w])), call. = FALSE, domain = NA)
 stop(packageNotFoundError(package, lib.loc, sys.call()))
+}
 txt <- if(length(lib.loc))
 gettextf("there is no package called %s", sQuote(package))
 else


Thank you!

Best regards,

Marcel



--
Marcel Ramos
Bioconductor Core Team
Roswell Park Comprehensive Care Center
Dept. of Biostatistics & Bioinformatics
Elm & Carlton Streets
Buffalo, New York 14263


This email message may contain legally privileged and/or confidential 
information.  If you are not the intended recipient(s), or the employee or 
agent responsible for the delivery of this message to the intended 
recipient(s), you are hereby notified that any disclosure, copying, 
distribution, or use of this email message is prohibited.  If you have received 
this message in error, please notify the sender immediately by e-mail and 
delete this email message from your computer. Thank you.
[[alternative HTML version deleted]]

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


Re: [Rd] Suggested Patch: Library returns matching installed packages when typo present

2019-06-21 Thread Marcel Ramos
Hi Luke,

Thank you for your response.

On 6/21/19 10:56 AM, Tierney, Luke wrote:

Thanks for the suggestion. However I don't think it is the right way
to go. I also don't care for what install.packages() does. Signaling a
warning and then an error means someone has to catch both the error
and the warning, or suppress the warning, in order to handle the error
programmatically.

I do care for what install.packages() does because it's preferable
to have consistency in the user interface.

I see that the proposed patch does return both an error and a warning
but as far as I understand it, library()'s main/intended use is interactive and
there are other functions available for programmatic use cases.



Now that library() signals a structured error there are other options.
One possibility, at least as an interim, is to define a
conditionMessage method, e.g. as

conditionMessage.packageNotFoundError <- function(c) {
 lib.loc <- c$lib.loc
 msg <- c$message
 package <- c$package
 if(length(lib.loc)) {
 allpkgs <- .packages(TRUE, lib.loc)
 if (!is.na(w <- match(tolower(package), tolower(allpkgs {
 msg2 <- sprintf("Perhaps you meant %s ?", sQuote(allpkgs[w]))
 return(paste(msg, msg2, sep = "\n"))
 }
 }
 msg
}

This is something you can do yourself, though it is generally not a
good idea to define a method when you don't own either the generic or
the class.

Something that would be useful and is being considered is having a
mechanism for registering default condition handlers. This would allow
the condition to be re-signaled with a custom class and then having
a custom conditionMessage method is less likely to cause conflicts.

I'd argue that this is quite useful especially for new users and that creating
condition handlers may involve more than what is needed for interactive use.


Best,

Marcel



Also worth looking into is establishing a restart around the error
signal.  This would allow an IDE, for example, to provide a dialog for
choosing the alternate package and retrying without the need to call
library() again. This is currently done in loadNamespace() but not yet
in library(). Can have downsides as well -- if the library() call is
in a notebook, for example, then you do want to fix the call ...  It
is arguably more useful in loadNamespace since that can get called
implicitly inside a longer computation that you don't necessarily want
to start over.

Best,

luke

On Fri, 21 Jun 2019, Marcel Ramos wrote:



Dear R-core devs,

I hope this email finds you well.

Please see the proposed patch to R-devel below:

Scenario:

When loading a package using `library`, a package may not be found if the cases 
are not matching:

```


library(ORG.Hs.eg.db)


Error in library(ORG.Hs.eg.db) :
 there is no package called 'ORG.Hs.eg.db'
```


Suggested Patch:

Returns a message matching what `install.packages` returns in such situations:

```


library("ORG.Hs.eg.db")


Error in library("ORG.Hs.eg.db") :
  there is no package called 'ORG.Hs.eg.db'
In addition: Warning message:
Perhaps you meant 'org.Hs.eg.db' ?
```

This patch will be helpful with 'fat-finger' typos. It will match a package
called with `library` against installed packages.


svn diff:

Index: src/library/base/R/library.R
===
--- src/library/base/R/library.R(revision 76727)
+++ src/library/base/R/library.R(working copy)
@@ -300,8 +300,13 @@
pkgpath <- find.package(package, lib.loc, quiet = TRUE,
verbose = verbose)
if(length(pkgpath) == 0L) {
-if(length(lib.loc) && !logical.return)
+if(length(lib.loc) && !logical.return) {
+allpkgs <- .packages(TRUE, lib.loc)
+if (!is.na(w <- match(tolower(package), tolower(allpkgs
+warning(sprintf("Perhaps you meant %s ?",
+sQuote(allpkgs[w])), call. = FALSE, domain = NA)
stop(packageNotFoundError(package, lib.loc, sys.call()))
+}
    txt <- if(length(lib.loc))
gettextf("there is no package called %s", sQuote(package))
else


Thank you!

Best regards,

Marcel



--
Marcel Ramos
Bioconductor Core Team
Roswell Park Comprehensive Care Center
Dept. of Biostatistics & Bioinformatics
Elm & Carlton Streets
Buffalo, New York 14263


This email message may contain legally privileged and/or confidential 
information.  If you are not the intended recipient(s), or the employee or 
agent responsible for the delivery of this message to the intended 
recipient(s), you are hereby notified that any disclosure, copying, 
distribution, or us

Re: [Rd] GitHub passwords in .git/config?

2019-07-15 Thread Marcel Ramos
Hi Spencer,

The first line in the `[remote "origin"]` section should read:

```

url = 
g...@github.com:sbgraves237/Ecdat.git

```

Generally, I add these configs by doing a clone on the command line such as:

> git clone 
> g...@github.com:sbgraves237/Ecdat.git

so that I don't have to mess with the config file.


Best,

Marcel

On 7/15/19 1:48 PM, Spencer Graves wrote:
I'm diverging:  Now I get:


>>> git pull
ssh: Could not resolve hostname github.com:sbgraves237: nodename nor servname 
provided, or not known
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.


  ** With .git/config as follows:


[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
[remote "origin"]
url = 
ssh://g...@github.com:sbgraves237/Ecdat.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master


  I have an SSH key on my GitHub account, which says it was "Added on Jul 
3, 2019 Last used within the last 2 weeks — Read/write".


  Should I delete my current local copies and clone them fresh from GitHub?
  Spencer


On 2019-07-15 12:01, Brian G. Peterson wrote:
it would be:

ssh://g...@github.com:sbgraves237/Ecdat.git


On Mon, 2019-07-15 at 11:41 -0500, Spencer Graves wrote:
On 2019-07-15 10:56, Dirk Eddelbuettel wrote:



Don't write passwords down like this. Your error is likely in
expecting _ssh_
authentication over _https_ -- when it works only over ssh. Use the
alternate
form for a remote e.g. one that looks like 
g...@github.com:emacs-
ess/ESS.git
I'm confused.  I changed that line to:


  url =
https://g...@github.com:sbgraves237/sbgraves237/Ecdat


Then when I did "git pull" I got:


fatal: unable to access
'https://g...@github.com:sbgraves237/sbgraves237/Ecdat/':
 Port number
ended with 's'


???
Thanks,
Spencer

Hth, Dirk

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

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


This email message may contain legally privileged and/or confidential 
information.  If you are not the intended recipient(s), or the employee or 
agent responsible for the delivery of this message to the intended 
recipient(s), you are hereby notified that any disclosure, copying, 
distribution, or use of this email message is prohibited.  If you have received 
this message in error, please notify the sender immediately by e-mail and 
delete this email message from your computer. Thank you.
[[alternative HTML version deleted]]

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