Skip to contents

This function will run a Shiny app but will pass arbitrary parameters (`NAME = VALUE`) through the `...` parameter to the application. This is done by modifying the Shiny UI and server function environments.

This function will traverse up the environment tree looking for the given parameter. Optionally, if `type_check` is set to an `is.` type function (e.g. `is.numeric`, `is.list`, etc.) it will check the object type. If the object is not found or the type doesn't match it will throw an error.

Usage

runAppWithParams(ui, server, ...)

get_shiny_parameter(param, type_check)

Arguments

ui

the Shiny ui object.

server

the Shiny server object.

...

[shiny::runApp()] parameters, [shiny::shinyApp()] parameters, or parameters to pass to the Shiny app.

param

the parameter name.

type_check

an `is.` function (e.g. `is.numeric`) to test the parameter type.

Examples

if (interactive()) { # Only run this example in interactive R sessions
library(ShinyDemo)
data(mtcars)
data(faithful)
runAppWithParams(ui = ShinyDemo::df_viewer_ui,
                 server = ShinyDemo::df_viewer_server,
                 data_frames = list(mtcars = mtcars, faithful = faithful),
                 port = 2112)
}