R/shiny_examples.R

Defines functions shiny_augment shiny_optimal

Documented in shiny_augment shiny_optimal

#' Shiny Optimal
#'
#' @description
#' Launches the demo shiny application to calculate optimal designs for Antoine's Equation
#'
#' @export
#'
#' @examples
#' shiny_optimal()
shiny_optimal <- function() {
  if(interactive()){
    if (!requireNamespace("tidyverse", quietly = TRUE)) {
      stop("Package \"tidyverse\" needed for this function to work. Please install it or access through https://kezrael.shinyapps.io/AntoineOptimal/.",
           call. = FALSE)
    } else if(!requireNamespace("markdown", quietly = TRUE)) {
      stop("Package \"markdown\" needed for this function to work. Please install it or access through https://kezrael.shinyapps.io/AntoineOptimal/.",
           call. = FALSE)
    }
    appDir <- system.file("shiny-examples", "D-Optimality", package = "optedr")
    if (appDir == "") {
      stop("Could not find example directory. Try re-installing `optedr`.", call. = FALSE)
    }

  shiny::runApp(appDir, display.mode = "normal")
  }
}



#' Shiny D-augment
#'
#' @description
#' Launches the demo shiny application to D-augment several prespecified models
#'
#' @export
#'
#' @examples
#' shiny_augment()
shiny_augment <- function() {
  if(interactive()){
    if (!requireNamespace("tidyverse", quietly = TRUE)) {
      stop("Package \"tidyverse\" needed for this function to work. Please install it or access through https://kezrael.shinyapps.io/AddPoints/.",
           call. = FALSE)
    } else if(!requireNamespace("markdown", quietly = TRUE)) {
      stop("Package \"markdown\" needed for this function to work. Please install it or access through https://kezrael.shinyapps.io/AddPoints/.",
           call. = FALSE)
    }
    appDir <- system.file("shiny-examples", "AddPoints", package = "optedr")
    if (appDir == "") {
      stop("Could not find example directory. Try re-installing `optedr`.", call. = FALSE)
    }

    shiny::runApp(appDir, display.mode = "normal")
  }
}

Try the optedr package in your browser

Any scripts or data that you put into this service are public.

optedr documentation built on Nov. 18, 2022, 5:12 p.m.