-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.R
executable file
·46 lines (37 loc) · 1.15 KB
/
build.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
#!/usr/bin/Rscript --vanilla
#
# Check if rmarkdown package is installed
if (!requireNamespace("rmarkdown", quietly = TRUE)) {
# Set default CRAN mirror
options(repos = c(CRAN = "https://cran.rstudio.com/"))
# Install rmarkdown package
install.packages("rmarkdown")
}
# Check if bookdown package is installed
if (!requireNamespace("bookdown", quietly = TRUE)) {
# Set default CRAN mirror
options(repos = c(CRAN = "https://cran.rstudio.com/"))
# Install bookdown package
install.packages("bookdown")
}
# Check if downlit package is installed
if (!requireNamespace("downlit", quietly = TRUE)) {
# Set default CRAN mirror
options(repos = c(CRAN = "https://cran.rstudio.com/"))
# Install downlit package
install.packages("downlit")
}
# Check if xml2 package is installed
if (!requireNamespace("xml2", quietly = TRUE)) {
# Set default CRAN mirror
options(repos = c(CRAN = "https://cran.rstudio.com/"))
# Install xml2 package
install.packages("xml2")
}
# Load required packages
library(rmarkdown)
library(bookdown)
library(downlit)
library(xml2)
# Render the site
rmarkdown::render_site(output_format = 'bookdown::bs4_book', encoding = 'UTF-8')