Files
annotate/detectors/cds/tools/lib/install.rpackages.r
alain viari 2d404b5b24 removed need of R igraph from chlorodb/subdb
Former-commit-id: 574aace9be5804d728a877110f5f475d61644f75
Former-commit-id: 2e7ea63447643830a62f18a364327d7b396ec140
2015-11-14 22:13:55 +01:00

31 lines
600 B
R
Executable File

#!/usr/bin/env Rscript
#
# check and install required packages
#
out <- function(...) {
cat(paste0('+ ', ..., '\n'), file=stderr())
}
installed <- function(package) {
package %in% rownames(installed.packages())
}
check <- function(package, repos="http://cran.univ-lyon1.fr") {
if (installed(package)) {
out("R package ", package, " installed")
} else {
out("Installing R package ", package, " from ", repos)
install.packages(package, repos=repos)
}
invisible(installed(package))
}
check("grid")
check("gridExtra")
check("vcd")
check("plotrix")
quit(save='no', status=0)