mirror of
https://github.com/rstudio/shiny.git
synced 2026-04-29 03:00:45 -04:00
217 lines
14 KiB
HTML
217 lines
14 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>Table Output — tableOutput • shiny</title><!-- favicons --><link rel="icon" type="image/png" sizes="16x16" href="../favicon-16x16.png"><link rel="icon" type="image/png" sizes="32x32" href="../favicon-32x32.png"><link rel="apple-touch-icon" type="image/png" sizes="180x180" href="../apple-touch-icon.png"><link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png"><link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png"><link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png"><!-- jquery --><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></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="Table Output — tableOutput"><meta property="og:description" content="The tableOuptut()/renderTable() pair creates a reactive table that is
|
|
suitable for display small matrices and data frames. The columns are
|
|
formatted with xtable::xtable().
|
|
See renderDataTable() for data frames that are too big to fit on a single
|
|
page."><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.8.0</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>Table Output</h1>
|
|
<small class="dont-index">Source: <a href="https://github.com/rstudio/shiny/blob/HEAD/R/bootstrap.R" class="external-link"><code>R/bootstrap.R</code></a>, <a href="https://github.com/rstudio/shiny/blob/HEAD/R/render-table.R" class="external-link"><code>R/render-table.R</code></a></small>
|
|
<div class="hidden name"><code>renderTable.Rd</code></div>
|
|
</div>
|
|
|
|
<div class="ref-description">
|
|
<p>The <code>tableOuptut()</code>/<code>renderTable()</code> pair creates a reactive table that is
|
|
suitable for display small matrices and data frames. The columns are
|
|
formatted with <code><a href="https://rdrr.io/pkg/xtable/man/xtable.html" class="external-link">xtable::xtable()</a></code>.</p>
|
|
<p>See <code><a href="renderDataTable.html">renderDataTable()</a></code> for data frames that are too big to fit on a single
|
|
page.</p>
|
|
</div>
|
|
|
|
<div id="ref-usage">
|
|
<div class="sourceCode"><pre class="sourceCode r"><code><span><span class="fu">tableOutput</span><span class="op">(</span><span class="va">outputId</span><span class="op">)</span></span>
|
|
<span></span>
|
|
<span><span class="fu">renderTable</span><span class="op">(</span></span>
|
|
<span> <span class="va">expr</span>,</span>
|
|
<span> striped <span class="op">=</span> <span class="cn">FALSE</span>,</span>
|
|
<span> hover <span class="op">=</span> <span class="cn">FALSE</span>,</span>
|
|
<span> bordered <span class="op">=</span> <span class="cn">FALSE</span>,</span>
|
|
<span> spacing <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">"s"</span>, <span class="st">"xs"</span>, <span class="st">"m"</span>, <span class="st">"l"</span><span class="op">)</span>,</span>
|
|
<span> width <span class="op">=</span> <span class="st">"auto"</span>,</span>
|
|
<span> align <span class="op">=</span> <span class="cn">NULL</span>,</span>
|
|
<span> rownames <span class="op">=</span> <span class="cn">FALSE</span>,</span>
|
|
<span> colnames <span class="op">=</span> <span class="cn">TRUE</span>,</span>
|
|
<span> digits <span class="op">=</span> <span class="cn">NULL</span>,</span>
|
|
<span> na <span class="op">=</span> <span class="st">"NA"</span>,</span>
|
|
<span> <span class="va">...</span>,</span>
|
|
<span> env <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/sys.parent.html" class="external-link">parent.frame</a></span><span class="op">(</span><span class="op">)</span>,</span>
|
|
<span> quoted <span class="op">=</span> <span class="cn">FALSE</span>,</span>
|
|
<span> outputArgs <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html" class="external-link">list</a></span><span class="op">(</span><span class="op">)</span></span>
|
|
<span><span class="op">)</span></span></code></pre></div>
|
|
</div>
|
|
|
|
<div id="arguments">
|
|
<h2>Arguments</h2>
|
|
<dl><dt>outputId</dt>
|
|
<dd><p>output variable to read the table from</p></dd>
|
|
|
|
|
|
<dt>expr</dt>
|
|
<dd><p>An expression that returns an R object that can be used with
|
|
<code><a href="https://rdrr.io/pkg/xtable/man/xtable.html" class="external-link">xtable::xtable()</a></code>.</p></dd>
|
|
|
|
|
|
<dt>striped, hover, bordered</dt>
|
|
<dd><p>Logicals: if <code>TRUE</code>, apply the
|
|
corresponding Bootstrap table format to the output table.</p></dd>
|
|
|
|
|
|
<dt>spacing</dt>
|
|
<dd><p>The spacing between the rows of the table (<code>xs</code>
|
|
stands for "extra small", <code>s</code> for "small", <code>m</code> for "medium"
|
|
and <code>l</code> for "large").</p></dd>
|
|
|
|
|
|
<dt>width</dt>
|
|
<dd><p>Table width. Must be a valid CSS unit (like "100%", "400px",
|
|
"auto") or a number, which will be coerced to a string and
|
|
have "px" appended.</p></dd>
|
|
|
|
|
|
<dt>align</dt>
|
|
<dd><p>A string that specifies the column alignment. If equal to
|
|
<code>'l'</code>, <code>'c'</code> or <code>'r'</code>, then all columns will be,
|
|
respectively, left-, center- or right-aligned. Otherwise, <code>align</code>
|
|
must have the same number of characters as the resulting table (if
|
|
<code>rownames = TRUE</code>, this will be equal to <code>ncol()+1</code>), with
|
|
the <em>i</em>-th character specifying the alignment for the
|
|
<em>i</em>-th column (besides <code>'l'</code>, <code>'c'</code> and
|
|
<code>'r'</code>, <code>'?'</code> is also permitted - <code>'?'</code> is a placeholder
|
|
for that particular column, indicating that it should keep its default
|
|
alignment). If <code>NULL</code>, then all numeric/integer columns (including
|
|
the row names, if they are numbers) will be right-aligned and
|
|
everything else will be left-aligned (<code>align = '?'</code> produces the
|
|
same result).</p></dd>
|
|
|
|
|
|
<dt>rownames, colnames</dt>
|
|
<dd><p>Logicals: include rownames? include colnames
|
|
(column headers)?</p></dd>
|
|
|
|
|
|
<dt>digits</dt>
|
|
<dd><p>An integer specifying the number of decimal places for
|
|
the numeric columns (this will not apply to columns with an integer
|
|
class). If <code>digits</code> is set to a negative value, then the numeric
|
|
columns will be displayed in scientific format with a precision of
|
|
<code>abs(digits)</code> digits.</p></dd>
|
|
|
|
|
|
<dt>na</dt>
|
|
<dd><p>The string to use in the table cells whose values are missing
|
|
(i.e. they either evaluate to <code>NA</code> or <code>NaN</code>).</p></dd>
|
|
|
|
|
|
<dt>...</dt>
|
|
<dd><p>Arguments to be passed through to <code><a href="https://rdrr.io/pkg/xtable/man/xtable.html" class="external-link">xtable::xtable()</a></code>
|
|
and <code><a href="https://rdrr.io/pkg/xtable/man/print.xtable.html" class="external-link">xtable::print.xtable()</a></code>.</p></dd>
|
|
|
|
|
|
<dt>env</dt>
|
|
<dd><p>The parent environment for the reactive expression. By default,
|
|
this is the calling environment, the same as when defining an ordinary
|
|
non-reactive expression. If <code>expr</code> is a quosure and <code>quoted</code> is <code>TRUE</code>,
|
|
then <code>env</code> is ignored.</p></dd>
|
|
|
|
|
|
<dt>quoted</dt>
|
|
<dd><p>If it is <code>TRUE</code>, then the <code><a href="https://rdrr.io/r/base/substitute.html" class="external-link">quote()</a></code>ed value of <code>expr</code>
|
|
will be used when <code>expr</code> is evaluated. If <code>expr</code> is a quosure and you
|
|
would like to use its expression as a value for <code>expr</code>, then you must set
|
|
<code>quoted</code> to <code>TRUE</code>.</p></dd>
|
|
|
|
|
|
<dt>outputArgs</dt>
|
|
<dd><p>A list of arguments to be passed through to the
|
|
implicit call to <code>tableOutput()</code> when <code>renderTable</code> is
|
|
used in an interactive R Markdown document.</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"># table example</span></span></span>
|
|
<span class="r-in"><span> <span class="fu"><a href="shinyApp.html">shinyApp</a></span><span class="op">(</span></span></span>
|
|
<span class="r-in"><span> ui <span class="op">=</span> <span class="fu"><a href="fluidPage.html">fluidPage</a></span><span class="op">(</span></span></span>
|
|
<span class="r-in"><span> <span class="fu"><a href="fluidPage.html">fluidRow</a></span><span class="op">(</span></span></span>
|
|
<span class="r-in"><span> <span class="fu"><a href="column.html">column</a></span><span class="op">(</span><span class="fl">12</span>,</span></span>
|
|
<span class="r-in"><span> <span class="fu">tableOutput</span><span class="op">(</span><span class="st">'table'</span><span class="op">)</span></span></span>
|
|
<span class="r-in"><span> <span class="op">)</span></span></span>
|
|
<span class="r-in"><span> <span class="op">)</span></span></span>
|
|
<span class="r-in"><span> <span class="op">)</span>,</span></span>
|
|
<span class="r-in"><span> server <span class="op">=</span> <span class="kw">function</span><span class="op">(</span><span class="va">input</span>, <span class="va">output</span><span class="op">)</span> <span class="op">{</span></span></span>
|
|
<span class="r-in"><span> <span class="va">output</span><span class="op">$</span><span class="va">table</span> <span class="op"><-</span> <span class="fu">renderTable</span><span class="op">(</span><span class="va">iris</span><span class="op">)</span></span></span>
|
|
<span class="r-in"><span> <span class="op">}</span></span></span>
|
|
<span class="r-in"><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, 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.0.7.</p>
|
|
</div>
|
|
|
|
</footer></div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</body></html>
|
|
|