-
Notifications
You must be signed in to change notification settings - Fork 0
/
r-dependencies.R
56 lines (51 loc) · 1.08 KB
/
r-dependencies.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
# Install remotes package if needed
if (!requireNamespace("remotes", quietly = TRUE)) {
install.packages("remotes", repos = "http://cran.rstudio.com/")
}
# List of packages and versions
packages_to_install <- c(
"igraph",
"bnlearn",
"ggraph",
"tidygraph",
"tidyverse",
"arules",
"mclust",
"rpart",
"stringr",
"purrr",
"readxl",
"tidyr",
"dplyr",
"optparse",
"svglite"
)
versions <- c(
"1.5.1",
"4.8.3",
"2.1.0",
"1.2.3",
"2.0.0",
"1.7.6",
"6.0.0",
"4.1.19",
"1.5.0",
"1.0.2",
"1.4.3",
"1.3.0",
"1.1.3",
"1.7.3",
"2.1.1"
)
# Function to install package if not already installed
install_if_needed <- function(package, version) {
if (!requireNamespace(package, quietly = TRUE)) {
remotes::install_version(package, version, repos = "http://cran.rstudio.com/")
}
}
# Install packages
for (i in 1:length(packages_to_install)) {
install_if_needed(packages_to_install[i], versions[i])
}
# Load the libraries
lapply(packages_to_install, require, character.only = TRUE)