xtable.summary {papeR} | R Documentation |
Create And Print Tables With Markup
Description
The function produces objects which can be printed to LaTeX and HTML code.
Usage
## S3 method for class 'summary'
xtable(x, caption = NULL, label = NULL, align = NULL,
digits = NULL, display = NULL, ...)
## S3 method for class 'xtable.summary'
print(x, rules = NULL, header = NULL,
caption.placement = getOption("xtable.caption.placement", "top"),
hline.after = getOption("xtable.hline.after", NULL),
include.rownames = FALSE,
add.to.row = getOption("xtable.add.to.row", NULL),
booktabs = getOption("xtable.booktabs", TRUE),
sanitize.text.function = get_option(x, "sanitize"),
math.style.negative = getOption("xtable.math.style.negative", TRUE),
math.style.exponents = getOption("xtable.math.style.exponents", TRUE),
tabular.environment = getOption("xtable.tabular.environment", "tabular"),
floating = getOption("xtable.floating", FALSE),
latex.environments = getOption("xtable.latex.environments", c("center")),
...)
Arguments
x |
object of class |
caption |
character vector specifying the table's caption; see
|
label |
character string specifying the LaTeX label or HTML anchor; see
|
align |
character string specifying the alignment of table columns; see
|
digits |
numeric vector specifying the number of digits to display in each
column; see |
display |
character string specifying the column types; see
|
rules |
character string specifying the rules to be used. Per default the
|
header |
character string specifying the table header to be used. Per default the
|
caption.placement |
can be either |
hline.after |
vector indicating the rows after which a horizontal line is printed.
Here, the default is to not draw hlines (i.e. |
add.to.row |
list of row numbers ( |
include.rownames |
logical. Always set to |
booktabs |
logical. If |
sanitize.text.function |
All non-numeric enteries (except row and column names) are sanitised
in an attempt to remove characters which have special meaning for
the output format. Per default the function |
math.style.negative |
logical. If |
math.style.exponents |
logical. If |
tabular.environment |
character string. Per default |
floating |
logical. Determine if the table is printed in a floating
environment. Note that the standard default of
|
latex.environments |
character string. Per default |
... |
additional arguments passed to |
Details
We use the standard xtable
function but add a special class
that allows different defaults in the print.xtable
function.
In general, all options of print.xtable
can be used as well as
global options set via options()
. E.g.
options(xtable.booktabs = FALSE
will set the argument booktabs
per default to
FALSE
for all calls to print.xtable
.
Value
After printing, a table with LaTeX markup is returned.
Author(s)
Benjamin Hofner
See Also
For details see xtable
and
print.xtable
.
Examples
if (require("nlme")) {
## Use dataset Orthodont
data(Orthodont, package = "nlme")
## Get summary for continuous variables
(tab1 <- summarize(Orthodont, type = "numeric"))
## Get summary for categorical variables
(tab2 <- summarize(Orthodont, type = "fac"))
## Using the tables with LaTeX
if (require("xtable")) {
xtable(tab1)
## grouped table
xtable(summarize(Orthodont, group = "Sex"))
xtable(tab2)
}
}