R/ggraptR.R

#' Launch ggraptR in the default browser
#'
#' @details See \url{http://github.com/cargomoose/raptR} for documentation and tutorials
#'
#' @examples
#' if (interactive()) {
#'   ggraptR()
#' }
#' @export

#prep the default data frame global variable to be used by ggraptR (see generalWidgets.R)
gDefaultDataFrame <<- ""

ggraptR <- function(df="diamonds") {
  appDir <- system.file("ggraptR", package = "ggraptR")
  if (appDir == "") {
    stop("Could not find example directory. Try re-installing `mypackage`.", call. = FALSE)
  }

  gDefaultDataFrame <<- if (typeof(df) == "character") {
     df    
  } else {
    list(deparse(substitute(df)))
  }

  shiny::runApp(appDir, display.mode = "normal")  
}
cargomoose/ggraptR1 documentation built on May 13, 2019, 12:41 p.m.