runApp
From shiny v0.12.2
by Winston Chang
Run Shiny Application
Runs a Shiny application. This function normally does not return; interrupt R to stop the application (usually by pressing Ctrl+C or Esc).
Usage
runApp(appDir = getwd(), port = getOption("shiny.port"),
launch.browser = getOption("shiny.launch.browser", interactive()),
host = getOption("shiny.host", "127.0.0.1"), workerId = "",
quiet = FALSE, display.mode = c("auto", "normal", "showcase"))
Arguments
- appDir
- The directory of the application. Should contain
server.R
, plus, eitherui.R
or awww
directory that contains the fileindex.html
. Alternately, instead ofserver.R
andui.R
, the - port
- The TCP port that the application should listen on. If the
port
is not specified, and theshiny.port
option is set (withoptions(shiny.port = XX)
), then that port will be used. Otherwise, use a random port. - launch.browser
- If true, the system's default web browser will be launched automatically after the app is started. Defaults to true in interactive sessions only. This value of this parameter can also be a function to call with the application's URL.
- host
- The IPv4 address that the application should listen on. Defaults
to the
shiny.host
option, if set, or"127.0.0.1"
if not. See Details. - workerId
- Can generally be ignored. Exists to help some editions of Shiny Server Pro route requests to the correct process.
- quiet
- Should Shiny status messages be shown? Defaults to FALSE.
- display.mode
- The mode in which to display the application. If set to
the value
"showcase"
, shows application code and metadata from aDESCRIPTION
file in the application directory alongside the application. If set to"normal"
Details
The host parameter was introduced in Shiny 0.9.0. Its default value of
"127.0.0.1"
means that, contrary to previous versions of Shiny, only
the current machine can access locally hosted Shiny apps. To allow other
clients to connect, use the value "0.0.0.0"
instead (which was the
value that was hard-coded into Shiny in 0.8.0 and earlier).
Examples
# Start app in the current working directory
runApp()
# Start app in a subdirectory called myapp
runApp("myapp")
## Only run this example in interactive R sessions
if (interactive()) {
# Apps can be run without a server.r and ui.r file
runApp(list(
ui = bootstrapPage(
numericInput('n', 'Number of obs', 100),
plotOutput('plot')
),
server = function(input, output) {
output$plot <- renderPlot({ hist(runif(input$n)) })
}
))
# Running a Shiny app object
app <- shinyApp(
ui = bootstrapPage(
numericInput('n', 'Number of obs', 100),
plotOutput('plot')
),
server = function(input, output) {
output$plot <- renderPlot({ hist(runif(input$n)) })
}
)
runApp(app)
}
Community examples
Looks like there are no examples yet.