forked from Tusharjamdade/pr-test
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.R
More file actions
33 lines (29 loc) · 1007 Bytes
/
app.R
File metadata and controls
33 lines (29 loc) · 1007 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
# Main entry point for the Shiny app
# Load libraries
tryCatch({
required_pkgs <- c(
"sparklyr", "dplyr", "data.table", "purrr", "tibble",
"writexl", "ggplot2", "rlang", "survival", "survminer",
"ggpubr", "tidyr", "DT", "shinythemes", "shiny", "shinyjs"
)
# Install missing packages only
missing_pkgs <- setdiff(required_pkgs, rownames(installed.packages()))
if (length(missing_pkgs) > 0) {
install.packages(missing_pkgs)
}
# Load all packages
invisible(lapply(required_pkgs, library, character.only = TRUE))
}, error = function(e) {
message("An error occurred: ", e$message)
})
tryCatch({
source("global.R")
source("ui.R")
if (!exists("ui")) stop("ui.R must define a variable 'ui'")
source("server.R")
if (!exists("server")) stop("server.R must define a variable 'server'")
shinyApp(ui = ui, server = server)
}, error = function(e) {
message("An error occurred while starting the Shiny app:")
message(e$message)
})