| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/bootstrap.R, R/render-table.R |
| 3 |
\name{tableOutput} |
| 4 |
\alias{tableOutput} |
| 5 |
\alias{renderTable} |
| 6 |
\title{Table Output} |
| 7 |
\usage{ |
| 8 |
tableOutput(outputId) |
| 9 |
|
| 10 |
renderTable( |
| 11 |
expr, |
| 12 |
striped = FALSE, |
| 13 |
hover = FALSE, |
| 14 |
bordered = FALSE, |
| 15 |
spacing = c("s", "xs", "m", "l"), |
| 16 |
width = "auto", |
| 17 |
align = NULL, |
| 18 |
rownames = FALSE, |
| 19 |
colnames = TRUE, |
| 20 |
digits = NULL, |
| 21 |
na = "NA", |
| 22 |
..., |
| 23 |
env = parent.frame(), |
| 24 |
quoted = FALSE, |
| 25 |
outputArgs = list() |
| 26 |
) |
| 27 |
} |
| 28 |
\arguments{ |
| 29 |
\item{outputId}{output variable to read the table from} |
| 30 |
|
| 31 |
\item{expr}{An expression that returns an R object that can be used with |
| 32 |
\code{\link[xtable:xtable]{xtable::xtable()}}.} |
| 33 |
|
| 34 |
\item{striped, hover, bordered}{Logicals: if \code{TRUE}, apply the |
| 35 |
corresponding Bootstrap table format to the output table.} |
| 36 |
|
| 37 |
\item{spacing}{The spacing between the rows of the table (\code{xs} |
| 38 |
stands for "extra small", \code{s} for "small", \code{m} for "medium" |
| 39 |
and \code{l} for "large").} |
| 40 |
|
| 41 |
\item{width}{Table width. Must be a valid CSS unit (like "100\%", "400px", |
| 42 |
"auto") or a number, which will be coerced to a string and |
| 43 |
have "px" appended.} |
| 44 |
|
| 45 |
\item{align}{A string that specifies the column alignment. If equal to |
| 46 |
\code{'l'}, \code{'c'} or \code{'r'}, then all columns will be, |
| 47 |
respectively, left-, center- or right-aligned. Otherwise, \code{align} |
| 48 |
must have the same number of characters as the resulting table (if |
| 49 |
\code{rownames = TRUE}, this will be equal to \code{ncol()+1}), with |
| 50 |
the \emph{i}-th character specifying the alignment for the |
| 51 |
\emph{i}-th column (besides \code{'l'}, \code{'c'} and |
| 52 |
\code{'r'}, \code{'?'} is also permitted - \code{'?'} is a placeholder |
| 53 |
for that particular column, indicating that it should keep its default |
| 54 |
alignment). If \code{NULL}, then all numeric/integer columns (including |
| 55 |
the row names, if they are numbers) will be right-aligned and |
| 56 |
everything else will be left-aligned (\code{align = '?'} produces the |
| 57 |
same result).} |
| 58 |
|
| 59 |
\item{rownames, colnames}{Logicals: include rownames? include colnames |
| 60 |
(column headers)?} |
| 61 |
|
| 62 |
\item{digits}{An integer specifying the number of decimal places for |
| 63 |
the numeric columns (this will not apply to columns with an integer |
| 64 |
class). If \code{digits} is set to a negative value, then the numeric |
| 65 |
columns will be displayed in scientific format with a precision of |
| 66 |
\code{abs(digits)} digits.} |
| 67 |
|
| 68 |
\item{na}{The string to use in the table cells whose values are missing |
| 69 |
(i.e. they either evaluate to \code{NA} or \code{NaN}).} |
| 70 |
|
| 71 |
\item{...}{Arguments to be passed through to \code{\link[xtable:xtable]{xtable::xtable()}} |
| 72 |
and \code{\link[xtable:print.xtable]{xtable::print.xtable()}}.} |
| 73 |
|
| 74 |
\item{env}{The parent environment for the reactive expression. By default, |
| 75 |
this is the calling environment, the same as when defining an ordinary |
| 76 |
non-reactive expression. If \code{expr} is a quosure and \code{quoted} is \code{TRUE}, |
| 77 |
then \code{env} is ignored.} |
| 78 |
|
| 79 |
\item{quoted}{If it is \code{TRUE}, then the \code{\link[=quote]{quote()}}ed value of \code{expr} |
| 80 |
will be used when \code{expr} is evaluated. If \code{expr} is a quosure and you |
| 81 |
would like to use its expression as a value for \code{expr}, then you must set |
| 82 |
\code{quoted} to \code{TRUE}.} |
| 83 |
|
| 84 |
\item{outputArgs}{A list of arguments to be passed through to the |
| 85 |
implicit call to \code{\link[=tableOutput]{tableOutput()}} when \code{renderTable} is |
| 86 |
used in an interactive R Markdown document.} |
| 87 |
} |
| 88 |
\description{ |
| 89 |
The \code{tableOuptut()}/\code{renderTable()} pair creates a reactive table that is |
| 90 |
suitable for display small matrices and data frames. The columns are |
| 91 |
formatted with \code{\link[xtable:xtable]{xtable::xtable()}}. |
| 92 |
|
| 93 |
See \code{\link[=renderDataTable]{renderDataTable()}} for data frames that are too big to fit on a single |
| 94 |
page. |
| 95 |
} |
| 96 |
\examples{ |
| 97 |
## Only run this example in interactive R sessions |
| 98 |
if (interactive()) { |
| 99 |
# table example |
| 100 |
shinyApp( |
| 101 |
ui = fluidPage( |
| 102 |
fluidRow( |
| 103 |
column(12, |
| 104 |
tableOutput('table') |
| 105 |
) |
| 106 |
) |
| 107 |
), |
| 108 |
server = function(input, output) { |
| 109 |
output$table <- renderTable(iris) |
| 110 |
} |
| 111 |
) |
| 112 |
} |
| 113 |
} |