Like 'require()' except it will attempt to install a package if necessary, and will also deal automatically with bioconductor packages too. Useful if you wish to share code with people who may not have the same libraries as you, you can include a call to this function which will simply load the library if present, or else install, then load, if they do not have it.
must.use.package(pcknms, bioC = FALSE, ask = FALSE, reload = FALSE,
avail = FALSE, quietly = FALSE)
nothing, simply loads the packages specified if possible
list of packages to load/install, shouldn't mix bioconductor/CRAN in one call
whether the listed packages are from bioconductor
whether to get the user's permission to install a required package, or just go ahead and do it
indicates to reload the package even if loaded
when bioC=FALSE, see whether pcknms are in the list of available CRAN packages
passed to library/require, display installation text or not
Nicholas Cooper njcooper@gmx.co.uk
# not run : run if you are ok to install/already have these packages
# must.use.package(c("MASS","nlme","lme4"),ask=FALSE)
# must.use.package("limma",bioC=TRUE)
# search() # show packages have loaded, then detach them again:
# sapply(paste("package",c("limma","MASS","nlme","lme4"),sep=":"),detach,character.only=TRUE)
Run the code above in your browser using DataLab