-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.R
More file actions
43 lines (37 loc) · 919 Bytes
/
app.R
File metadata and controls
43 lines (37 loc) · 919 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
40
41
42
43
required_pkgs <- c(
"shiny",
"bs4Dash",
"plotly",
"markdown",
"DT",
"dplyr",
"tidyr",
"tibble",
"readr",
"tidygraph",
"igraph",
"ggplot2"
)
missing_pkgs <- required_pkgs[!vapply(required_pkgs, requireNamespace, logical(1), quietly = TRUE)]
if (length(missing_pkgs) > 0) {
stop(
sprintf(
"Please install required packages before running the app: %s",
paste(missing_pkgs, collapse = ", ")
),
call. = FALSE
)
}
for (pkg in required_pkgs) {
suppressPackageStartupMessages(
library(pkg, character.only = TRUE)
)
}
r_scripts <- list.files("R", pattern = "\\.R$", full.names = TRUE)
invisible(lapply(r_scripts, source))
shiny::addResourcePath("man", "man")
shiny::addResourcePath("inst", "inst")
shiny::addResourcePath("docs", "docs")
source("ui.R", local = TRUE)
source("server.R", local = TRUE)
shinyApp(ui = ui, server = server, options = "launch.browser")