
Former-commit-id: 574aace9be5804d728a877110f5f475d61644f75 Former-commit-id: 2e7ea63447643830a62f18a364327d7b396ec140
31 lines
600 B
R
Executable File
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)
|
|
|