Add a table to a pdf by generating R markdown, intended to be used within the expr
argument to write_pdf.
Thin wrapper around knitr::kable that generates latex output.
Arguments
- x
data frame to export
- ...
Arguments passed on to
knitr::kable
digits
Maximum number of digits for numeric columns, passed to
round()
. This can also be a vector of lengthncol(x)
, to set the number of digits for individual columns.row.names
Logical: whether to include row names. By default, row names are included if
rownames(x)
is neitherNULL
nor identical to1:nrow(x)
.col.names
A character vector of column names to be used in the table.
align
Column alignment: a character vector consisting of
'l'
(left),'c'
(center) and/or'r'
(right). By default or ifalign = NULL
, numeric columns are right-aligned, and other columns are left-aligned. Iflength(align) == 1L
, the string will be expanded to a vector of individual letters, e.g.'clc'
becomesc('c', 'l', 'c')
, unless the output format is LaTeX.caption
The table caption. By default, it is retrieved from the chunk option
tab.cap
.label
The table reference label. By default, the label is obtained from
knitr::opts_current$get('label')
(i.e., the current chunk label). To disable the label, uselabel = NA
.format.args
A list of arguments to be passed to
format()
to format table values, e.g.list(big.mark = ',')
.