generated from berkeley-dsep-infra/hub-user-image-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
install.R
executable file
·33 lines (30 loc) · 1.17 KB
/
install.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env R
# Function to install R packages with specific versions
class_libs_install_version <- function(class_name, class_libs) {
print(paste("Installing packages for", class_name))
for (i in seq(1, length(class_libs), 2)) {
installed_packages <- rownames(installed.packages())
package_name = class_libs[i]
version = class_libs[i+1]
# Only install packages if they haven't already been installed!
# devtools doesn't do that by default
if (!package_name %in% installed_packages) {
print(paste("Installing", package_name, version))
devtools::install_version(package_name, version, quiet=TRUE)
} else {
# FIXME: This ignores version incompatibilities :'(
print(paste("Not installing", package_name, " as it is already installed"))
}
}
print(paste("Done installing packages for", class_name))
}
# R packages to be installed that aren't from apt
# Combination of informal requests & rocker image suggestions
# Some of these were already in datahub image
cran_packages = c(
"BiocManager", "1.30.21",
"IRkernel", "1.3.2",
"rmarkdown", "2.22",
"shiny", "1.7.4"
)
class_libs_install_version("Base packages", cran_packages)