File: runGadget.Rd

package info (click to toggle)
r-cran-shiny 1.0.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 4,080 kB
  • ctags: 290
  • sloc: makefile: 22; sh: 13
file content (52 lines) | stat: -rw-r--r-- 1,474 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/server.R
\name{runGadget}
\alias{runGadget}
\title{Run a gadget}
\usage{
runGadget(app, server = NULL, port = getOption("shiny.port"),
  viewer = paneViewer(), stopOnCancel = TRUE)
}
\arguments{
\item{app}{Either a Shiny app object as created by
\code{\link[=shiny]{shinyApp}} et al, or, a UI object.}

\item{server}{Ignored if \code{app} is a Shiny app object; otherwise, passed
along to \code{shinyApp} (i.e. \code{shinyApp(ui = app, server = server)}).}

\item{port}{See \code{\link[=shiny]{runApp}}.}

\item{viewer}{Specify where the gadget should be displayed--viewer pane,
dialog window, or external browser--by passing in a call to one of the
\code{\link{viewer}} functions.}

\item{stopOnCancel}{If \code{TRUE} (the default), then an \code{observeEvent}
is automatically created that handles \code{input$cancel} by calling
\code{stopApp()} with an error. Pass \code{FALSE} if you want to handle
\code{input$cancel} yourself.}
}
\value{
The value returned by the gadget.
}
\description{
Similar to \code{runApp}, but handles \code{input$cancel} automatically, and
if running in RStudio, defaults to viewing the app in the Viewer pane.
}
\examples{
\dontrun{
library(shiny)

ui <- fillPage(...)

server <- function(input, output, session) {
  ...
}

# Either pass ui/server as separate arguments...
runGadget(ui, server)

# ...or as a single app object
runGadget(shinyApp(ui, server))
}
}