latex.tabular {tables} | R Documentation |
Display a tabular object using LaTeX.
Description
This is similar to print.tabular
, but it inserts the code to
display the table in a LaTeX tabular environment. The toLatex.tabular
method works with the toLatex
generic
from utils.
Usage
toLatex(object, ...)
## S3 method for class 'tabular'
toLatex(object, file = "", options = NULL, append = FALSE, ...)
latex.tabular(object, ...)
Arguments
object |
The tabular object. |
file |
A filename or connection to which to write the LaTeX code, or
|
options |
A list of options to set for the duration of the call. |
append |
If |
... |
Settings for default formatting. See Details below. |
Details
The toLatex()
method produces LaTeX output suitable for inclusion in a Sweave
document.
The latex.tabular
function is set up
to work as a method for the latex
generic in Hmisc,
but is not registered as a method, so that tables can
work when Hmisc is not installed.
Value
The toLatex()
method returns x
invisibly, and prints the LaTeX script to the console.
table_options()
and booktabs()
return the previous settings.
Note
For historical reasons, the toLatex()
function with a non-empty file
argument
doesn't write to the file until the returned value is printed.
See Also
print.tabular
, table_options
,
toLatex
, latex
Examples
tab <- tabular( (Species + 1) ~ (n=1) + Format(digits=2)*
(Sepal.Length + Sepal.Width)*(mean + sd), data=iris )
toLatex(tab)
save <- booktabs()
toLatex(tab)
table_options(save)