textable {miscset} | R Documentation |
Table to Latex
Description
This function enhances xtable
: It can write the latex code of the
table directly to a file and optionally adds a header/footer for the
document structure. Also a system command can be given to convert the
tex file to a pdf document, for example.
Usage
textable(d, file, caption = NULL, label = NULL, align = NULL,
rownames = FALSE, topcapt = TRUE, digits = NULL, as.document = FALSE,
landscape = FALSE, margin = 2, pt.size = 10, cmd = NULL, ...)
Arguments
d |
Object (will be coerced to data.frame) to transform to a latex table. |
file |
Character string with output file name. If missing or |
caption |
Character vector with title of table. |
label |
Character vector with the latex label or HTML anchor. |
align |
Character vector with |
rownames |
Logical, include row names of |
topcapt |
Logical, put caption and label before 'tabular'. |
digits |
Number of digits to print from numeric values. |
as.document |
Logical. |
landscape |
Logical, use a landscape format for wider tables.
Only with |
margin |
Margin between table and page border in cm.
Only with |
pt.size |
Integer from 10 to 13 for the size of the characters.
Only with |
cmd |
A character vector with the system command to apply
on the output file. Only if |
... |
Forwarded arguments to print.xtable. |
Details
Example for a system call:
cmd = "pdflatex -output-directory /path/to/files/"
Value
Returns a character vector invisible. If file
is set, then the
content is written to a file. Else it is printed to the console.
Author(s)
Sven E. Templer
See Also
Examples
#
## Not run:
d <- head(trees)
dc <- 'R "trees" dataset.'
textable(d, rownames=TRUE, digits=4, caption=dc)
textable(d, '/tmp/trees.tex', caption=dc, as.document=TRUE,
cmd='pdflatex --output-directory /tmp')
## End(Not run)
#