toLatex-ftable | R Documentation |
The ftable
method of toLatex()
converts
an ftable
to a LaTeX table via tablines()
.
Analogously, the varlist
method of
toLatex()
converts an varlist
to a LaTeX table.
fftable()
essentially calls format.ftable()
and adds
attributes ncv
and nrv
to the return object.
tablines()
computes ingredients for converting a
character
matrix
with attributes to a
LaTeX table.
cattablines()
is a small auxiliary function which creates rows
of a LaTeX table from a given matrix.
## S3 method for class 'ftable'
toLatex(object, vList = NULL,
x.escape = FALSE, exprFUN = expr2latex, escapeFUN = escapeLatex,
align = NULL, booktabs = TRUE, head = NULL,
rsep = "\\\\", sp = if(booktabs) 3 else 1.25, rsep.sp = NULL,
csep = " & ", quote = FALSE, lsep=" \\textbar\\ ",
do.table = TRUE, placement = "htbp", center = TRUE,
fontsize = "normalsize", caption = NULL, label = NULL, ...)
## S3 method for class 'varlist'
toLatex(object,
col.vars = c("Variable", "expression", "type", "value"),
exprFUN = expr2latex, escapeFUN = escapeLatex,
align = NULL, booktabs = TRUE, head = NULL,
rsep = "\\\\", sp = if(booktabs) 3 else 1.25, rsep.sp = NULL, csep = " & ",
do.table = TRUE, placement = "htbp", center = TRUE,
fontsize = "normalsize", caption = NULL, label = NULL, ...)
fftable(x, lsep = " | ", quote = FALSE, method = "compact", ...)
tablines(x, align = NULL, booktabs = TRUE, head = NULL,
rsep = "\\\\", sp = if(booktabs) 3 else 1.25, rsep.sp = NULL,
csep = " & ", quote = FALSE)
cattablines(x, rsep = "\\\\", csep = " & ", include.rownames = TRUE)
object |
an |
x |
for |
vList |
a variable specification list see |
x.escape |
logical indicating if the “body” entries of the
table should be escaped by |
exprFUN |
a function, by default |
escapeFUN |
a function, by default |
align |
either a |
booktabs |
|
head |
either
|
rsep |
|
sp |
|
rsep.sp |
|
csep |
|
quote, lsep, method |
see |
col.vars |
character vector of length 3 or 4 ( |
do.table |
|
placement |
(if |
center |
|
fontsize |
|
caption |
(if |
label |
(if |
include.rownames |
|
... |
additional arguments passed to |
toLatex()
returns an object as from wrapLaTable()
.
fftable()
returns a formatted flat contingency table as
returned by format.ftable()
with added attributes ncv
(number of column variables) and nrv
(number of row variables).
tablines()
a list with components
body |
|
body.raw |
|
head |
|
head.raw |
|
align |
alignment string. |
rsepcol |
|
cattablines()
outputs the formatted lines for copy-and-paste
into a LaTeX table.
Marius Hofert and Martin Maechler.
see simsalapar-package
.
wrapLaTable()
for how to wrap the lines of a LaTeX table
created by tablines()
in a LaTeX table and tabular environment.
## Different table layouts for the same content
(ft1 <- ftable(Titanic, col.vars = 1:4))
(ft2 <- ftable(Titanic, row.vars = 1))
(ft3 <- ftable(Titanic, row.vars = 1:2))
(ft4 <- ftable(Titanic, row.vars = 1:3))
(ft5 <- ftable(Titanic, row.vars = 1:4))
## What tablines() returns
tablines(fftable(ft2))
## LaTeX (booktabs/non-booktabs) versions
toLatex(ft1, do.table=FALSE)
toLatex(ft1, booktabs=FALSE)
toLatex(ft1, method="col.compact")
toLatex(ft1)
toLatex(ft2)
toLatex(ft3)
toLatex(ft4)
toLatex(ft5, booktabs=FALSE)
toLatex(ft5, method="col.compact")
toLatex(ft5)
## ``poor-man's approach'' for creating lines of a LaTeX table
set.seed(271)
tab <- matrix(runif(6), ncol=3)
ftab <- formatC(tab, digits=4, format="f")
cattablines(ftab)
rownames(ftab) <- LETTERS[1:nrow(ftab)]
cattablines(ftab)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.