-
Notifications
You must be signed in to change notification settings - Fork 1
/
requirements.R
126 lines (115 loc) · 2.48 KB
/
requirements.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
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
############################## MPA Europe project ##############################
########### WP3 - Species and biogenic habitat distributions (UNESCO) ##########
# March of 2024
# Authors: Silas C. Principe, Pieter Provoost
# Contact: [email protected]
############################ Project Requirements ##############################
# Needed packages on CRAN
req_packages <- c(
"furrr",
"progressr",
"storr",
"arrow",
"dplyr",
"terra",
"stars",
"cli",
"fs",
"purrr",
"devtools",
"hypervolume",
"ggplot2",
"patchwork",
"tools",
"utils",
"sf",
"ecospat",
"ks",
"ade4",
"spatstat",
"ragg",
"stringr",
"raster",
"predicts",
"worrms",
"rstudioapi",
"rgbif",
"yaml",
"glue",
"virtualspecies",
"lubridate",
"geohashTools",
"rfishbase",
"robis",
"readr",
"DBI",
"duckdb",
"blockCV",
"rnaturalearth",
"isotree",
"reticulate",
"sp",
"ecodist",
"spThin",
"modEvA",
"precrec",
"rlang",
"maxnet",
"glmnet",
"dismo",
"randomForest",
"mgcv",
"xgboost",
"lightgbm",
"leaflet",
"sys",
"jsonlite",
"gbifdb",
"minioclient",
"BiocManager",
"sfarrow"
)
# Needed packages on GitHub
git_packages <- c("flexsdm", "prg", "obissdm", "obistools", "biooracler")
git_packages_source <- c(
"sjevelazco/flexsdm@HEAD",
"meeliskull/prg/R_package/prg",
"iobis/mpaeu_msdm",
"iobis/obistools",
"bio-oracle/biooracler"
)
# Bioconductor packages
bioc_packages <- c("Rarr")
# Packages with special installation
special_packages <- "polars"
# 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])) {
install.packages(req_packages[i])
}
}
# Check github packages
for (i in 1:length(git_packages)) {
if (!is_package_installed(git_packages[i])) {
devtools::install_github(git_packages_source[i])
}
}
# Check bioconductor packages
for (i in 1:length(bioc_packages)) {
if (!is_package_installed(bioc_packages[i])) {
BiocManager::install(bioc_packages[i])
}
}
is_polar_inst <- is_package_installed(special_packages)
if (!is_polar_inst) {
Sys.setenv(NOT_CRAN = "true")
install.packages("polars", repos = "https://rpolars.r-universe.dev")
}
# Install minioclient
minioclient::install_mc(force = TRUE)
# Install Python packages
reticulate::py_install(c("rio-cogeo", "xarray", "zarr"), pip = TRUE)