Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

renderTable

Table Output


Description

Creates a reactive table that is suitable for assigning to an output slot.

Usage

renderTable(
  expr,
  striped = FALSE,
  hover = FALSE,
  bordered = FALSE,
  spacing = c("s", "xs", "m", "l"),
  width = "auto",
  align = NULL,
  rownames = FALSE,
  colnames = TRUE,
  digits = NULL,
  na = "NA",
  ...,
  env = parent.frame(),
  quoted = FALSE,
  outputArgs = list()
)

Arguments

expr

An expression that returns an R object that can be used with xtable::xtable().

striped, hover, bordered

Logicals: if TRUE, apply the corresponding Bootstrap table format to the output table.

spacing

The spacing between the rows of the table (xs stands for "extra small", s for "small", m for "medium" and l for "large").

width

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.

align

A string that specifies the column alignment. If equal to 'l', 'c' or 'r', then all columns will be, respectively, left-, center- or right-aligned. Otherwise, align must have the same number of characters as the resulting table (if rownames = TRUE, this will be equal to ncol()+1), with the i-th character specifying the alignment for the i-th column (besides 'l', 'c' and 'r', '?' is also permitted - '?' is a placeholder for that particular column, indicating that it should keep its default alignment). If NULL, then all numeric/integer columns (including the row names, if they are numbers) will be right-aligned and everything else will be left-aligned (align = '?' produces the same result).

rownames, colnames

Logicals: include rownames? include colnames (column headers)?

digits

An integer specifying the number of decimal places for the numeric columns (this will not apply to columns with an integer class). If digits is set to a negative value, then the numeric columns will be displayed in scientific format with a precision of abs(digits) digits.

na

The string to use in the table cells whose values are missing (i.e. they either evaluate to NA or NaN).

...

Arguments to be passed through to xtable::xtable() and xtable::print.xtable().

env

The environment in which to evaluate expr.

quoted

Is expr a quoted expression (with quote())? This is useful if you want to save an expression in a variable.

outputArgs

A list of arguments to be passed through to the implicit call to tableOutput() when renderTable is used in an interactive R Markdown document.

Details

The corresponding HTML output tag should be div and have the CSS class name shiny-html-output.


shiny

Web Application Framework for R

v1.6.0
GPL-3 | file LICENSE
Authors
Winston Chang [aut, cre], Joe Cheng [aut], JJ Allaire [aut], Carson Sievert [aut], Barret Schloerke [aut], Yihui Xie [aut], Jeff Allen [aut], Jonathan McPherson [aut], Alan Dipert [aut], Barbara Borges [aut], RStudio [cph], jQuery Foundation [cph] (jQuery library and jQuery UI library), jQuery contributors [ctb, cph] (jQuery library; authors listed in inst/www/shared/jquery-AUTHORS.txt), jQuery UI contributors [ctb, cph] (jQuery UI library; authors listed in inst/www/shared/jqueryui/AUTHORS.txt), Mark Otto [ctb] (Bootstrap library), Jacob Thornton [ctb] (Bootstrap library), Bootstrap contributors [ctb] (Bootstrap library), Twitter, Inc [cph] (Bootstrap library), Prem Nawaz Khan [ctb] (Bootstrap accessibility plugin), Victor Tsaran [ctb] (Bootstrap accessibility plugin), Dennis Lembree [ctb] (Bootstrap accessibility plugin), Srinivasu Chakravarthula [ctb] (Bootstrap accessibility plugin), Cathy O'Connor [ctb] (Bootstrap accessibility plugin), PayPal, Inc [cph] (Bootstrap accessibility plugin), Stefan Petre [ctb, cph] (Bootstrap-datepicker library), Andrew Rowls [ctb, cph] (Bootstrap-datepicker library), Dave Gandy [ctb, cph] (Font-Awesome font), Brian Reavis [ctb, cph] (selectize.js library), Salmen Bejaoui [ctb, cph] (selectize-plugin-a11y library), Denis Ineshin [ctb, cph] (ion.rangeSlider library), Sami Samhuri [ctb, cph] (Javascript strftime library), SpryMedia Limited [ctb, cph] (DataTables library), John Fraser [ctb, cph] (showdown.js library), John Gruber [ctb, cph] (showdown.js library), Ivan Sagalaev [ctb, cph] (highlight.js library), R Core Team [ctb, cph] (tar implementation from R)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.