mirror of
https://github.com/rstudio/shiny.git
synced 2026-04-29 03:00:45 -04:00
156 lines
11 KiB
HTML
156 lines
11 KiB
HTML
<!DOCTYPE html>
|
|
<!-- Generated by pkgdown: do not edit by hand --><html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Run Shiny Example Applications — runExample • shiny</title><!-- jquery --><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js" integrity="sha512-v2CJ7UaYy4JwqLDIrZUI/4hqeoQieOmAZNXBeQyjo21dadnwR+8ZaIJVT8EE2iyI61OV8e6M8PP2/4hpQINQ/g==" crossorigin="anonymous" referrerpolicy="no-referrer"></script><!-- Bootstrap --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha256-bZLfwXAP04zRMK2BjiO8iu9pf4FbLqX6zitd+tIvLhE=" crossorigin="anonymous"><script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha256-nuL8/2cJ5NDSSwnKD8VqreErSWHtnEP9E7AySL+1ev4=" crossorigin="anonymous"></script><!-- bootstrap-toc --><link rel="stylesheet" href="../bootstrap-toc.css"><script src="../bootstrap-toc.js"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/all.min.css" integrity="sha256-mmgLkCYLUQbXn0B1SRqzHar6dCnv9oZFPEC1g1cwlkk=" crossorigin="anonymous"><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/v4-shims.min.css" integrity="sha256-wZjR52fzng1pJHwx4aV2AO3yyTOXrcDW7jBpJtTwVxw=" crossorigin="anonymous"><!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js" integrity="sha256-inc5kl9MA1hkeYUt+EC3BhlIgyp/2jDIyBLS6k3UxPI=" crossorigin="anonymous"></script><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/headroom.min.js" integrity="sha256-AsUX4SJE1+yuDu5+mAVzJbuYNPHj/WroHuZ8Ir/CkE0=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script><!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet"><script src="../pkgdown.js"></script><meta property="og:title" content="Run Shiny Example Applications — runExample"><meta property="og:description" content="Launch Shiny example applications, and optionally, your system's web browser."><meta property="og:image" content="/logo.png"><!-- mathjax --><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script><!--[if lt IE 9]>
|
|
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
|
|
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
|
|
<![endif]--></head><body data-spy="scroll" data-target="#toc">
|
|
|
|
|
|
<div class="container template-reference-topic">
|
|
<header><div class="navbar navbar-default navbar-fixed-top" role="navigation">
|
|
<div class="container">
|
|
<div class="navbar-header">
|
|
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false">
|
|
<span class="sr-only">Toggle navigation</span>
|
|
<span class="icon-bar"></span>
|
|
<span class="icon-bar"></span>
|
|
<span class="icon-bar"></span>
|
|
</button>
|
|
<span class="navbar-brand">
|
|
<a class="navbar-link" href="../index.html">shiny</a>
|
|
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="">1.12.1</span>
|
|
</span>
|
|
</div>
|
|
|
|
<div id="navbar" class="navbar-collapse collapse">
|
|
<ul class="nav navbar-nav"><li>
|
|
<a href="../reference/index.html">Reference</a>
|
|
</li>
|
|
<li>
|
|
<a href="../news/index.html">Changelog</a>
|
|
</li>
|
|
</ul><ul class="nav navbar-nav navbar-right"><li>
|
|
<a href="https://github.com/rstudio/shiny/" class="external-link">
|
|
<span class="fab fa-github fa-lg"></span>
|
|
|
|
</a>
|
|
</li>
|
|
</ul></div><!--/.nav-collapse -->
|
|
</div><!--/.container -->
|
|
</div><!--/.navbar -->
|
|
|
|
|
|
|
|
</header><div class="row">
|
|
<div class="col-md-9 contents">
|
|
<div class="page-header">
|
|
<h1>Run Shiny Example Applications</h1>
|
|
<small class="dont-index">Source: <a href="https://github.com/rstudio/shiny/blob/rc-v1.12.1/R/runapp.R" class="external-link"><code>R/runapp.R</code></a></small>
|
|
<div class="hidden name"><code>runExample.Rd</code></div>
|
|
</div>
|
|
|
|
<div class="ref-description">
|
|
<p>Launch Shiny example applications, and optionally, your system's web browser.</p>
|
|
</div>
|
|
|
|
<div id="ref-usage">
|
|
<div class="sourceCode"><pre class="sourceCode r"><code><span><span class="fu">runExample</span><span class="op">(</span></span>
|
|
<span> example <span class="op">=</span> <span class="cn">NA</span>,</span>
|
|
<span> port <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/options.html" class="external-link">getOption</a></span><span class="op">(</span><span class="st">"shiny.port"</span><span class="op">)</span>,</span>
|
|
<span> launch.browser <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/options.html" class="external-link">getOption</a></span><span class="op">(</span><span class="st">"shiny.launch.browser"</span>, <span class="fu"><a href="https://rdrr.io/r/base/interactive.html" class="external-link">interactive</a></span><span class="op">(</span><span class="op">)</span><span class="op">)</span>,</span>
|
|
<span> host <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/options.html" class="external-link">getOption</a></span><span class="op">(</span><span class="st">"shiny.host"</span>, <span class="st">"127.0.0.1"</span><span class="op">)</span>,</span>
|
|
<span> display.mode <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="st">"auto"</span>, <span class="st">"normal"</span>, <span class="st">"showcase"</span><span class="op">)</span>,</span>
|
|
<span> package <span class="op">=</span> <span class="st">"shiny"</span></span>
|
|
<span><span class="op">)</span></span></code></pre></div>
|
|
</div>
|
|
|
|
<div id="arguments">
|
|
<h2>Arguments</h2>
|
|
|
|
|
|
<dl><dt id="arg-example">example<a class="anchor" aria-label="anchor" href="#arg-example"></a></dt>
|
|
<dd><p>The name of the example to run, or <code>NA</code> (the default) to
|
|
list the available examples.</p></dd>
|
|
|
|
|
|
<dt id="arg-port">port<a class="anchor" aria-label="anchor" href="#arg-port"></a></dt>
|
|
<dd><p>The TCP port that the application should listen on. If the
|
|
<code>port</code> is not specified, and the <code>shiny.port</code> option is set (with
|
|
<code>options(shiny.port = XX)</code>), then that port will be used. Otherwise,
|
|
use a random port between 3000:8000, excluding ports that are blocked
|
|
by Google Chrome for being considered unsafe: 3659, 4045, 5060,
|
|
5061, 6000, 6566, 6665:6669 and 6697. Up to twenty random
|
|
ports will be tried.</p></dd>
|
|
|
|
|
|
<dt id="arg-launch-browser">launch.browser<a class="anchor" aria-label="anchor" href="#arg-launch-browser"></a></dt>
|
|
<dd><p>If true, the system's default web browser will be
|
|
launched automatically after the app is started. Defaults to true in
|
|
interactive sessions only.</p></dd>
|
|
|
|
|
|
<dt id="arg-host">host<a class="anchor" aria-label="anchor" href="#arg-host"></a></dt>
|
|
<dd><p>The IPv4 address that the application should listen on. Defaults
|
|
to the <code>shiny.host</code> option, if set, or <code>"127.0.0.1"</code> if not.</p></dd>
|
|
|
|
|
|
<dt id="arg-display-mode">display.mode<a class="anchor" aria-label="anchor" href="#arg-display-mode"></a></dt>
|
|
<dd><p>The mode in which to display the example. Defaults to
|
|
<code>"auto"</code>, which uses the value of <code>DisplayMode</code> in the example's
|
|
<code>DESCRIPTION</code> file. Set to <code>"showcase"</code> to show the app code and
|
|
description with the running app, or <code>"normal"</code> to see the example without
|
|
code or commentary.</p></dd>
|
|
|
|
|
|
<dt id="arg-package">package<a class="anchor" aria-label="anchor" href="#arg-package"></a></dt>
|
|
<dd><p>The package in which to find the example (defaults to
|
|
<code>"shiny"</code>).</p>
|
|
<p>To provide examples in your package, store examples in the
|
|
<code>inst/examples-shiny</code> directory of your package. Each example should be
|
|
in its own subdirectory and should be runnable when <code><a href="runApp.html">runApp()</a></code> is called
|
|
on the subdirectory. Example apps can include a <code>DESCRIPTION</code> file and a
|
|
<code>README.md</code> file to provide metadata and commentary about the example. See
|
|
the article on <a href="https://shiny.posit.co/r/articles/build/display-modes/" class="external-link">Display Modes</a>
|
|
on the Shiny website for more information.</p></dd>
|
|
|
|
</dl></div>
|
|
|
|
<div id="ref-examples">
|
|
<h2>Examples</h2>
|
|
<div class="sourceCode"><pre class="sourceCode r"><code><span class="r-in"><span><span class="co">## Only run this example in interactive R sessions</span></span></span>
|
|
<span class="r-in"><span><span class="kw">if</span> <span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/interactive.html" class="external-link">interactive</a></span><span class="op">(</span><span class="op">)</span><span class="op">)</span> <span class="op">{</span></span></span>
|
|
<span class="r-in"><span> <span class="co"># List all available examples</span></span></span>
|
|
<span class="r-in"><span> <span class="fu">runExample</span><span class="op">(</span><span class="op">)</span></span></span>
|
|
<span class="r-in"><span></span></span>
|
|
<span class="r-in"><span> <span class="co"># Run one of the examples</span></span></span>
|
|
<span class="r-in"><span> <span class="fu">runExample</span><span class="op">(</span><span class="st">"01_hello"</span><span class="op">)</span></span></span>
|
|
<span class="r-in"><span></span></span>
|
|
<span class="r-in"><span> <span class="co"># Print the directory containing the code for all examples</span></span></span>
|
|
<span class="r-in"><span> <span class="fu"><a href="https://rdrr.io/r/base/system.file.html" class="external-link">system.file</a></span><span class="op">(</span><span class="st">"examples"</span>, package<span class="op">=</span><span class="st">"shiny"</span><span class="op">)</span></span></span>
|
|
<span class="r-in"><span><span class="op">}</span></span></span>
|
|
</code></pre></div>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
|
|
<nav id="toc" data-toggle="toc" class="sticky-top"><h2 data-toc-skip>Contents</h2>
|
|
</nav></div>
|
|
</div>
|
|
|
|
|
|
<footer><div class="copyright">
|
|
<p></p><p>Developed by Winston Chang, Joe Cheng, JJ Allaire, Carson Sievert, Barret Schloerke, Garrick Aden-Buie, Yihui Xie, Jeff Allen, Jonathan McPherson, Alan Dipert, Barbara Borges, Posit Software, PBC.</p>
|
|
</div>
|
|
|
|
<div class="pkgdown">
|
|
<p></p><p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.2.0.</p>
|
|
</div>
|
|
|
|
</footer></div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</body></html>
|
|
|