X-Git-Url: https://git.nmode.ca/Rnaught/blobdiff_plain/18358add05e58e466ba7098f771e20d8d0599d0e..e1c61de5a0e693e2f24a1c4a10336e2a1c4563cb:/R/app.R?ds=sidebyside diff --git a/R/app.R b/R/app.R index 1bf3e93..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) }