-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall_pkgs.R
More file actions
36 lines (29 loc) · 1.04 KB
/
install_pkgs.R
File metadata and controls
36 lines (29 loc) · 1.04 KB
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
# 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$quail$`r-dependencies`
if (!requireNamespace("remotes", quietly = TRUE)) {
install.packages("remotes", repos = "https://cloud.r-project.org")
}
# Install packages with versions using remotes
for (pkg in names(deps)) {
ver <- deps[[pkg]]
if (!(pkg %in% rownames(installed.packages()))) {
if (is.null(ver) || ver == "*" || ver == "") {
install.packages(pkg, repos = "https://cloud.r-project.org")
} else {
remotes::install_version(pkg, version = ver, repos = "https://cloud.r-project.org")
}
}
}
remotes::install_github("pacificclimate/climdex.pcic@daf4790",
dependencies = TRUE,
)