R/ViewShinyPlp.R

Defines functions viewPlps viewPlp viewMultiplePlp

Documented in viewMultiplePlp viewPlp

#' open a local shiny app for viewing the result of a multiple PLP analyses
#'
#' @details
#' Opens a shiny app for viewing the results of the models from various T,O, Tar and settings
#' settings.
#' @param analysesLocation  The directory containing the results (with the analysis_x folders)
#' 
#' @export
viewMultiplePlp <- function(analysesLocation){
  viewPlps(result = analysesLocation, validation=NULL)
}

#' viewPlp - Interactively view the performance and model settings
#'
#' @description
#' This is a shiny app for viewing interactive plots of the performance and the settings
#' @details
#' Either the result of runPlp and view the plots
#' @param runPlp             The output of runPlp() (an object of class 'runPlp')
#' @param validatePlp  The output of externalValidatePlp (on object of class 'validatePlp')
#' @return
#' Opens a shiny app for interactively viewing the results
#'
#' @export

viewPlp <- function(runPlp, validatePlp = NULL) {
  viewPlps(result = runPlp, validation=validatePlp)
}


# code for multiple and single together
# one shiny app 

viewPlps <- function(result, validation=NULL){
  ensure_installed("shiny")
  ensure_installed("shinydashboard")
  ensure_installed("shinycssloaders")
  ensure_installed("DT")
  ensure_installed("htmlwidgets")
  ensure_installed("shinyWidgets")
 
  appDir <- system.file("shiny", "PLPViewer", package = "PatientLevelPrediction")
  shinySettings <- list(result = result, validation = validation)
  .GlobalEnv$shinySettings <- shinySettings
  on.exit(rm(shinySettings, envir = .GlobalEnv))
  shiny::runApp(appDir) 
}
hxia/plp-git-demo documentation built on March 19, 2021, 1:54 a.m.