FreesearchR/R/launch_FreesearchR.R

41 lines
1.3 KiB
R
Raw Normal View History

2025-03-19 09:14:36 +01:00
#' Easily launch the FreesearchR app
#'
#' @description
#' All data.frames in the global environment will be accessible through the app.
#'
#' @param include_globalenv flag to include global env (local data) as option
#' when loading data
#' @param data_limit_default default data set observations limit
#' @param data_limit_upper data set observations upper limit
#' @param data_limit_lower data set observations lower limit
2025-03-19 09:14:36 +01:00
#' @param ... passed on to `shiny::runApp()`
#'
#' @returns shiny app
#' @export
#'
#' @examples
#' \dontrun{
#' data(mtcars)
2025-04-29 12:11:38 +02:00
#' launch_FreesearchR(launch.browser = TRUE)
2025-03-19 09:14:36 +01:00
#' }
launch_FreesearchR <- function(inlcude_globalenv = TRUE,
data_limit_default = 1000,
data_limit_upper = 100000,
data_limit_lower = 1,
...) {
global_freesearchR <- list(
include_globalenv = include_globalenv,
data_limit_default = data_limit_default,
data_limit_upper = data_limit_upper,
data_limit_lower = data_limit_lower
)
2025-03-19 09:14:36 +01:00
appDir <- system.file("apps", "FreesearchR", package = "FreesearchR")
if (appDir == "") {
stop("Could not find the app directory. Try re-installing `FreesearchR`.",
call. = FALSE)
2025-03-19 09:14:36 +01:00
}
a <- shiny::runApp(appDir = paste0(appDir, "/app.R"), ...)
2025-03-19 09:14:36 +01:00
return(invisible(a))
}