aboutsummaryrefslogtreecommitdiff
path: root/R
diff options
context:
space:
mode:
Diffstat (limited to 'R')
-rw-r--r--R/app.R16
-rw-r--r--R/ui.R4
2 files changed, 15 insertions, 5 deletions
diff --git a/R/app.R b/R/app.R
index feb052f..945f9e4 100644
--- a/R/app.R
+++ b/R/app.R
@@ -1,9 +1,19 @@
#' Launch the Rnaught Web Application
#'
+#' @importFrom utils install.packages
+#'
#' @export
app <- function() {
- if (!requireNamespace("shiny", quietly = TRUE))
- stop("The package 'shiny' must be installed to launch the Rnaught web application.")
+ if (!requireNamespace("shiny", quietly = TRUE)) {
+ answer <- readline(paste0("The package 'shiny' must be installed to ",
+ "launch the Rnaught web application.\nWould you like to install it? ",
+ "[Y/n] "))
+
+ if (answer == "Y" || answer == "y")
+ install.packages("shiny")
+ else
+ stop("Aborting.", call. = FALSE)
+ }
- shiny::shinyApp(ui, server)
+ shiny::shinyApp(ui(), server)
}
diff --git a/R/ui.R b/R/ui.R
index 4e4a500..5c6d420 100644
--- a/R/ui.R
+++ b/R/ui.R
@@ -1,4 +1,4 @@
-ui <- shiny::fluidPage(
+ui <- function() { shiny::fluidPage(
# Title.
shiny::titlePanel(shiny::HTML(
paste0("Rnaught: An Estimation Suite for R", shiny::tags$sub("0")))),
@@ -194,4 +194,4 @@ ui <- shiny::fluidPage(
)
)
)
-)
+)}