R/ca_launch.R

Defines functions ca_launch

Documented in ca_launch

#' Launch a caladaptr demo app
#'
#' Launch a caladaptr demo Shiny app
#'
#' @param app App name
#' @param display.mode How to display the Shiny app
#'
#' @details
#'
#' @import caladaptr
#' @import conflicted
#' @import dplyr
#' @import ggplot2
#' @import htmltools
#' @import leaflet
#' @import lubridate
#' @import rmarkdown
#' @import scales
#' @import shiny
#' @import shinybusy
#' @import shinyhelper
#' @import tibble
#' @import tidyr
#' @import units
#' @export

## Taken out because it caused warnings: 
## @import DT 
## @importFrom DT dataTableOutput renderDataTable datatable

ca_launch <- function(app = c("timeseries", "chill", "chill2")[1], 
                      display.mode = c("normal", "showcase")[1]) {

  if (length(app) != 1) stop("app should be lenth 1", call. = FALSE)
  
  appDir <- system.file(paste0("shiny/", app), package = "caladaptr.apps")
  
  if (appDir == "") {
    stop(paste0("Could not find the `", app, "` app. Try re-installing `caladaptr.apps`."), call. = FALSE)
  }

  shiny::runApp(appDir, display.mode = display.mode)

}
UCANR-IGIS/caladaptr.apps documentation built on Aug. 7, 2022, 9:51 p.m.