[Bioc-devel] return value of BiocManager::install()

Levi Waldron |w@|dron@re@e@rch @end|ng |rom gm@||@com
Tue Jan 22 10:19:46 CET 2019


I opened an issue on BiocManager (
https://github.com/Bioconductor/BiocManager/issues/39) somewhat related to
Sean's recent post, about what BiocManager::install() should return, and it
occurs to me that I should mention it here too for feedback:

> Having `BiocManager::install()` return the "pkgs" argument is not
especially useful. Could it instead return success/error codes? Otherwise,
how can you tell in a script whether the requested packages were installed
successfully or not?

The most basic return value I can think of would be like `require()`, TRUE
if successful and FALSE if unsuccessful. More sophisticated behavior could
give different error codes for different failures, although I don't know
how difficult that would be to implement. This came up from wanting to test
a Docker container for ability to install many different packages within
it, and doing this by making a (hacked and specific to my purpose of
installing/testing one package at a time) wrapper around
`BiocManager::install()` that uses require() to test whether the
installation was successful. That said, the workaround was not that
difficult and it's probably not a priority for too many other users if
you're hesitant to change the return value of BiocManager::install().

installcheck <- function(x){
  if (x %in% installed.packages())
    return(TRUE)
  BiocManager::install(x, ask=FALSE, update=FALSE)
  res <- require(x, character.only = TRUE)
  detach(paste0("package:", x), unload=TRUE, character.only = TRUE)
  return(res)
}

	[[alternative HTML version deleted]]



More information about the Bioc-devel mailing list