-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpackages.R
More file actions
39 lines (34 loc) · 836 Bytes
/
packages.R
File metadata and controls
39 lines (34 loc) · 836 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
39
# List of required packages
required_packages <- c(
"ggplot2",
"dplyr",
"viridis",
"tidyr",
"broom",
"gsubfn",
"tidyverse",
"boot",
"broman",
"rsample",
"plotrix",
"ggrepel",
"JuliaCall",
"ggcorrplot",
"lmerTest",
"patchwork",
"cowplot",
"yaml"
)
# Install any missing packages
install_missing_packages <- function(packages) {
installed_packages <- rownames(installed.packages())
missing_packages <- packages[!(packages %in% installed_packages)]
if (length(missing_packages) > 0) {
install.packages(missing_packages)
}
}
install_missing_packages(required_packages)
# Load all the required packages
lapply(required_packages, library, character.only = TRUE)
# Optional: print a message indicating that all packages are loaded
cat("All required packages are installed and loaded.\n")