app: Expose Shiny app object

This commit is contained in:
Elias Projahn 2025-03-05 15:31:49 +01:00
parent 6f84555b9f
commit 13b3c2b119
4 changed files with 40 additions and 4 deletions

22
R/app.R
View file

@ -5,20 +5,34 @@
#' @param custom_dataset This allows to set a custom dataset (return value of
#' [analyze()]) as the default dataset of the UI.
#'
#' @seealso [app()] for retrieving a Shiny app object.
#'
#' @export
run_app <- function(host = "127.0.0.1",
port = 3464,
custom_dataset = NULL) {
runApp(
shinyApp(
ui(custom_dataset = custom_dataset),
server(custom_dataset = custom_dataset)
),
app(custom_dataset = custom_dataset),
host = host,
port = port
)
}
#' Create a shiny application for Ubigen.
#'
#' @param custom_dataset This allows to set a custom dataset (return value of
#' [analyze()]) as the default dataset of the UI.
#'
#' @seealso [run_app()] for immediately running the application.
#'
#' @export
app <- function(custom_dataset = NULL) {
shinyApp(
ui(custom_dataset = custom_dataset),
server(custom_dataset = custom_dataset)
)
}
#' Run the Ubigen API.
#'
#' This requires the `plumber` package to be installed.