-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall_pkgs.R
More file actions
40 lines (30 loc) · 1020 Bytes
/
install_pkgs.R
File metadata and controls
40 lines (30 loc) · 1020 Bytes
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
# Create user library
dir.create(Sys.getenv("R_LIBS_USER"), recursive = TRUE)
.libPaths(Sys.getenv("R_LIBS_USER"))
# Install and load RcppTOML
if (!requireNamespace("RcppTOML", quietly = TRUE)) {
install.packages("RcppTOML", repos = "https://cloud.r-project.org")
}
library(RcppTOML)
# Read the TOML file
toml_data <- RcppTOML::parseTOML("pyproject.toml")
# Extract dependencies
deps <- toml_data$tool$chickadee$`r-dependencies`
# Install devtools
install.packages("devtools", dependencies = TRUE)
library(devtools)
# Install packages with versions
for (pkg in names(deps)) {
ver <- deps[[pkg]]
if (!(pkg %in% rownames(installed.packages()))) {
if (is.null(ver) || ver == "*" || ver == "") {
install_version(pkg)
} else {
install_version(pkg, version = ver)
}
}
}
if (!requireNamespace("remotes", quietly = TRUE)) {
install.packages("remotes", repos = "https://cloud.r-project.org")
}
remotes::install_github("pacificclimate/ClimDown@2.0.0")