| print.xtable {xtable} | R Documentation |
Function returning and displaying or writing to disk the LaTeX or HTML
code associated with the supplied object of class xtable.
## S3 method for class 'xtable'
print(x,
type = getOption("xtable.type", "latex"),
file = getOption("xtable.file", ""),
append = getOption("xtable.append", FALSE),
floating = getOption("xtable.floating", TRUE),
floating.environment = getOption("xtable.floating.environment", "table"),
table.placement = getOption("xtable.table.placement", "ht"),
caption.placement = getOption("xtable.caption.placement", "bottom"),
caption.width = getOption("xtable.caption.width", NULL),
latex.environments = getOption("xtable.latex.environments", c("center")),
tabular.environment = getOption("xtable.tabular.environment", "tabular"),
size = getOption("xtable.size", NULL),
hline.after = getOption("xtable.hline.after", c(-1,0,nrow(x))),
NA.string = getOption("xtable.NA.string", ""),
include.rownames = getOption("xtable.include.rownames", TRUE),
include.colnames = getOption("xtable.include.colnames", TRUE),
only.contents = getOption("xtable.only.contents", FALSE),
add.to.row = getOption("xtable.add.to.row", NULL),
sanitize.text.function = getOption("xtable.sanitize.text.function", NULL),
sanitize.rownames.function = getOption("xtable.sanitize.rownames.function",
sanitize.text.function),
sanitize.colnames.function = getOption("xtable.sanitize.colnames.function",
sanitize.text.function),
math.style.negative = getOption("xtable.math.style.negative", FALSE),
html.table.attributes = getOption("xtable.html.table.attributes",
"border=1"),
print.results = getOption("xtable.print.results", TRUE),
format.args = getOption("xtable.format.args", NULL),
rotate.rownames = getOption("xtable.rotate.rownames", FALSE),
rotate.colnames = getOption("xtable.rotate.colnames", FALSE),
booktabs = getOption("xtable.booktabs", FALSE),
scalebox = getOption("xtable.scalebox", NULL),
width = getOption("xtable.width", NULL),
comment = getOption("xtable.comment", TRUE),
timestamp = getOption("xtable.timestamp", date()),
...)
x |
An object of class |
type |
Type of table to produce. Possible values for |
file |
Name of file where the resulting code should be saved. If
|
append |
If |
floating |
If |
floating.environment |
If |
table.placement |
If |
caption.placement |
The caption will be have placed at the bottom
of the table if |
caption.width |
The caption will be placed in a |
latex.environments |
If |
tabular.environment |
When |
size |
An arbitrary character vector intended to be used to set
the font size in a LaTeX table. The supplied value (if not
|
hline.after |
When |
NA.string |
String to be used for missing values in table
entries.
Default value is |
include.rownames |
logical. If |
include.colnames |
logical. If |
only.contents |
logical. If |
add.to.row |
a list of two components. The first component (which
should be called 'pos') is a list contains the position of rows on
which extra commands should be added at the end, The second
component (which should be called 'command') is a character vector
of the same length of the first component which contains the command
that should be added at the end of the specified rows.
Default value is |
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. If
|
sanitize.rownames.function |
Like the
|
sanitize.colnames.function |
Like the
|
math.style.negative |
In a LaTeX table, if |
html.table.attributes |
In an HTML table, attributes associated
with the |
print.results |
If |
format.args |
List of arguments for the |
rotate.rownames |
If |
rotate.colnames |
If |
booktabs |
If |
scalebox |
If not |
width |
If not |
comment |
If |
timestamp |
Timestamp to include in LaTeX comment. Set this
to |
... |
Additional arguments. (Currently ignored.) |
This function displays or writes to disk the code to produce a table
associated with an object x of class "xtable".
The resulting code is either a LaTeX or HTML table, depending on the
value of type. The function also (invisibly) returns a
character vector of the results (which can be helpful for
post-processing).
Since version 1.4 the non default behavior of hline.after is
changed. To obtain the same results as the previous versions add to
the hline.after vector the vector c(-1, 0, nrow(x))
where nrow(x) is the numbers of rows of the object.
From version 1.4-3, all non-numeric columns are sanitized, and all
LaTeX special characters are sanitised for LaTeX output. See Section
3 of the xtableGallery vignette for an example of customising
the sanitization. From version 1.4-4, the sanitization also applies to
column names. To remove any text sanitization, specify
sanitize.text.function=function(x){x}.
From version 1.6-1 the default values for the arguments other than
x are obtainined using getOption(). Hence the user can
set the values once with options() rather than setting them in
every call to print.xtable().
David Dahl dahl@stat.tamu.edu with contributions and suggestions from many others (see source code).
Fairbairns, Robin (2005) Tables longer than a single page The UK List of TeX Frequently Asked Questions on the Web. http://www.tex.ac.uk/cgi-bin/texfaq2html?label=longtab
xtable, caption, label,
align, digits, display,
formatC