forked from harvard-edge/cs249r_book
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall_packages.R
More file actions
38 lines (33 loc) · 1.2 KB
/
install_packages.R
File metadata and controls
38 lines (33 loc) · 1.2 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
37
38
# ==============================================================
# R Package Installation Script for Quarto GitHub Actions
#
# This script installs required R packages for rendering Quarto (.qmd) files.
# If you need to add a new package, follow the instructions below.
# ==============================================================
required_packages <- c(
"downlit", # Required for code linking in Quarto
"ggplot2", # Visualization package
"ggrepel", # Visualization package
"knitr", # Needed for Quarto rendering
"png", # PNG support
"rmarkdown", # Markdown rendering in R
"tidyverse", #
"reshape2", #
"reticulate", #
"rsvg", #
"viridis", #
"xml2" # Required for XML/HTML processing
)
install_if_missing <- function(pkg) {
if (!requireNamespace(pkg, quietly = TRUE)) {
install.packages(pkg, repos = "http://cran.rstudio.com")
}
}
invisible(sapply(required_packages, install_if_missing))
if (!requireNamespace("tinytex", quietly = TRUE)) {
install.packages("tinytex", repos = "http://cran.rstudio.com")
tinytex::install_tinytex()
}
cat("\n✅ Installed R Packages:\n")
installed_pkgs <- installed.packages()[, "Package"]
print(installed_pkgs)