| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/runapp.R |
| 3 |
\name{runExample} |
| 4 |
\alias{runExample} |
| 5 |
\title{Run Shiny Example Applications} |
| 6 |
\usage{ |
| 7 |
runExample( |
| 8 |
example = NA, |
| 9 |
port = getOption("shiny.port"), |
| 10 |
launch.browser = getOption("shiny.launch.browser", interactive()), |
| 11 |
host = getOption("shiny.host", "127.0.0.1"), |
| 12 |
display.mode = c("auto", "normal", "showcase"), |
| 13 |
package = "shiny" |
| 14 |
) |
| 15 |
} |
| 16 |
\arguments{ |
| 17 |
\item{example}{The name of the example to run, or \code{NA} (the default) to |
| 18 |
list the available examples.} |
| 19 |
|
| 20 |
\item{port}{The TCP port that the application should listen on. If the |
| 21 |
\code{port} is not specified, and the \code{shiny.port} option is set (with |
| 22 |
\code{options(shiny.port = XX)}), then that port will be used. Otherwise, |
| 23 |
use a random port between 3000:8000, excluding ports that are blocked |
| 24 |
by Google Chrome for being considered unsafe: 3659, 4045, 5060, |
| 25 |
5061, 6000, 6566, 6665:6669 and 6697. Up to twenty random |
| 26 |
ports will be tried.} |
| 27 |
|
| 28 |
\item{launch.browser}{If true, the system's default web browser will be |
| 29 |
launched automatically after the app is started. Defaults to true in |
| 30 |
interactive sessions only.} |
| 31 |
|
| 32 |
\item{host}{The IPv4 address that the application should listen on. Defaults |
| 33 |
to the \code{shiny.host} option, if set, or \code{"127.0.0.1"} if not.} |
| 34 |
|
| 35 |
\item{display.mode}{The mode in which to display the example. Defaults to |
| 36 |
\code{"auto"}, which uses the value of \code{DisplayMode} in the example's |
| 37 |
\code{DESCRIPTION} file. Set to \code{"showcase"} to show the app code and |
| 38 |
description with the running app, or \code{"normal"} to see the example without |
| 39 |
code or commentary.} |
| 40 |
|
| 41 |
\item{package}{The package in which to find the example (defaults to |
| 42 |
\code{"shiny"}). |
| 43 |
|
| 44 |
To provide examples in your package, store examples in the |
| 45 |
\code{inst/examples-shiny} directory of your package. Each example should be |
| 46 |
in its own subdirectory and should be runnable when \code{\link[=runApp]{runApp()}} is called |
| 47 |
on the subdirectory. Example apps can include a \code{DESCRIPTION} file and a |
| 48 |
\code{README.md} file to provide metadata and commentary about the example. See |
| 49 |
the article on \href{https://shiny.posit.co/r/articles/build/display-modes/}{Display Modes} |
| 50 |
on the Shiny website for more information.} |
| 51 |
} |
| 52 |
\description{ |
| 53 |
Launch Shiny example applications, and optionally, your system's web browser. |
| 54 |
} |
| 55 |
\examples{ |
| 56 |
## Only run this example in interactive R sessions |
| 57 |
if (interactive()) { |
| 58 |
# List all available examples |
| 59 |
runExample() |
| 60 |
|
| 61 |
# Run one of the examples |
| 62 |
runExample("01_hello") |
| 63 |
|
| 64 |
# Print the directory containing the code for all examples |
| 65 |
system.file("examples", package="shiny") |
| 66 |
} |
| 67 |
} |