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)
}