-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrequirements-r-colab.txt
70 lines (59 loc) · 2.29 KB
/
requirements-r-colab.txt
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
ubuntu_packages <- c("libudunits2-dev", "libgdal-dev", "libgeos-dev", "libproj-dev")
cli::cli_alert_info("Installing ubuntu packages")
system(paste("sudo apt install", paste(ubuntu_packages, collapse = " ")))
cli::cli_alert_info("Installing R packages on CRAN")
# To install by system binaries put as a name
# e.g. "sudo apt install r-cran-dplyr" = "dplyr"
req_packages <- c(
"sudo apt install r-cran-terra" = "terra",
"sudo apt install r-cran-sf" = "sf",
"sudo apt install r-cran-tidyverse" = "tidyverse",
"sudo apt install r-cran-devtools" = "devtools",
"sudo apt install r-cran-robis" = "robis",
"sudo apt install r-cran-arrow" = "arrow",
"sudo apt install r-cran-sfarrow" = "sfarrow",
"sudo apt install r-cran-stars" = "stars",
"sudo apt install r-cran-patchwork" = "patchwork"
#,"BiocManager"
)
#bioconductor_packages <- c("ggtree", "ggtreeExtra", "phyloseq")
# Needed packages on GitHub
git_packages <- c("obistools", "biooracler")
git_packages_source <- c(
"iobis/obistools",
"bio-oracle/biooracler"
)
# Create a function to check if is installed
is_package_installed <- function(pkg) {
requireNamespace(pkg, quietly = TRUE)
}
# Check which ones are not installed and install if needed:
for (i in 1:length(req_packages)) {
if (!is_package_installed(req_packages[i])) {
if (names(req_packages)[i] == "") {
cli::cli_alert_info("Installing {cli::bg_cyan(req_packages[i])} by install.packages")
install.packages(req_packages[i])
} else {
cli::cli_alert_info("Installing {cli::bg_cyan(req_packages[i])} by Ubuntu binaries")
system(names(req_packages)[i])
}
} else {
cli::cli_alert_success("{cli::bg_cyan(req_packages[i])} already installed.")
}
}
cli::cli_alert_info("Installing R packages on GitHub")
# Check github packages
for (i in 1:length(git_packages)) {
if (!is_package_installed(git_packages[i])) {
cli::cli_alert_info("Installing {cli::bg_cyan(git_packages_source[i])} by devtools")
devtools::install_github(git_packages_source[i])
} else {
cli::cli_alert_success("{cli::bg_cyan(git_packages_source[i])} already installed.")
}
}
# # Check bioconductor packages
# for (i in 1:length(bioconductor_packages)) {
# if (!is_package_installed(bioconductor_packages[i])) {
# BiocManager::install(bioconductor_packages[i])
# }
# }