2024-11-21 12:34:27 +01:00
|
|
|
#' Test version of the shiny_cast function to launch the app with a data set in
|
|
|
|
#' the environment.
|
|
|
|
#'
|
|
|
|
#' @param data optional data set to provide for analysis
|
|
|
|
#' @param ... arguments passed on to `shiny::runApp()`
|
|
|
|
#'
|
|
|
|
#' @return shiny app
|
|
|
|
#' @export
|
|
|
|
#'
|
|
|
|
#' @examples
|
|
|
|
#' \dontrun{
|
|
|
|
#' mtcars |> shiny_webResearch(launch.browser = TRUE)
|
|
|
|
#' }
|
|
|
|
shiny_webResearch <- function(data = NULL, ...) {
|
2024-12-17 11:31:42 +01:00
|
|
|
appDir <- system.file("apps", "data_analysis_modules", package = "webResearch")
|
2024-11-21 12:34:27 +01:00
|
|
|
if (appDir == "") {
|
2024-11-28 21:02:23 +01:00
|
|
|
stop("Could not find the app directory. Try re-installing `webResearch`.", call. = FALSE)
|
2024-11-21 12:34:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
G <- .GlobalEnv
|
2024-11-28 21:11:44 +01:00
|
|
|
|
|
|
|
if (!is.null(data) && is.data.frame(data)) {
|
|
|
|
assign("webResearch_data", data, envir = G)
|
|
|
|
}
|
2024-11-21 12:34:27 +01:00
|
|
|
a <- shiny::runApp(appDir = appDir, ...)
|
|
|
|
return(invisible(a))
|
|
|
|
}
|