-
Notifications
You must be signed in to change notification settings - Fork 0
/
runShinyApp.R
30 lines (24 loc) · 875 Bytes
/
runShinyApp.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
runShinyApp <- function(){
required_packages <- c("rstudioapi", "shiny", "shinyWidgets", "shinyalert", "shinybusy", "shinyjs", "shinyFiles",
"tibble", "jpeg", "tiff", "png", "raster", "scales", "plotly", "shapes", "dplyr", "mice")
# Load packages that are already installed
for (package in required_packages) {
if (require(package, character.only = TRUE)) {
library(package, character.only = TRUE)
}
}
# Install and load packages that are not installed
for (package in required_packages) {
if (!require(package, character.only = TRUE)) {
install.packages(package, dependencies = TRUE)
library(package, character.only = TRUE)
}
}
getwd()
setwd(dirname(getActiveDocumentContext()$path))
source("ui.R")
source("server.R")
shinyApp(ui = ui, server = server)
runApp(getwd())
}
runShinyApp()