Create a Shiny app object

shinyApp(ui, server, onStart = NULL, options = list(), uiPattern = "/")
shinyAppDir(appDir, options = list())
as.shiny.appobj(x)
"as.shiny.appobj"(x)
"as.shiny.appobj"(x)
"as.shiny.appobj"(x)
"print"(x, ...)
"as.tags"(x, ...)

Arguments

ui The UI definition of the app (for example, a call to fluidPage() with nested controls)
server A server function
onStart A function that will be called before the app is actually run. This is only needed for shinyAppObj, since in the shinyAppDir case, a global.R file can be used for this purpose.
options Named options that should be passed to the `runApp` call. You can also specify width and height parameters which provide a hint to the embedding environment about the ideal height/width for the app.
uiPattern A regular expression that will be applied to each GET request to determine whether the ui should be used to handle the request. Note that the entire request path must match the regular expression in order for the match to be considered successful.
appDir Path to directory that contains a Shiny app (i.e. a server.R file and either ui.R or www/index.html)
x Object to convert to a Shiny app.
... Additional parameters to be passed to print.

Create a Shiny app object

Value

An object that represents the app. Printing the object will run the app.

Description

These functions create Shiny app objects from either an explicit UI/server pair (shinyApp), or by passing the path of a directory that contains a Shiny app (shinyAppDir). You generally shouldn't need to use these functions to create/run applications; they are intended for interoperability purposes, such as embedding Shiny apps inside a knitr document.

Examples

## <strong>Not run</strong>: # shinyApp( # ui = fluidPage( # numericInput("n", "n", 1), # plotOutput("plot") # ), # server = function(input, output) { # output$plot <- renderPlot( plot(head(cars, input$n)) ) # }, # options=list(launch.browser = rstudio::viewer) # ) # # shinyAppDir(system.file("examples/01_hello", package="shiny")) # ## <strong>End(Not run)</strong>