as.tabular {latexpdf} | R Documentation |
Coerce to tabular
Description
Coerces to tabular. Generic, with methods for data.frame, table, and matrix.
Coerces to tabular from data.frame. Extra arguments passed to format.data.frame
.
Coerces to tabular from table.
Coerces to tabular from matrix.
Usage
as.tabular(x, ...)
## S3 method for class 'data.frame'
as.tabular(
x,
rules = c(2, 1, 1),
walls = 0,
grid = FALSE,
rowgroups = factor(rownames(x)),
colgroups = factor(names(x)),
rowbreaks = if (grid) breaks(rowgroups) else 0,
colbreaks = if (grid) breaks(colgroups) else 0,
rowgrouprule = 0,
colgrouprule = 0,
rowcolors = NULL,
rowgrouplabel = " ",
charjust = "left",
numjust = "right",
justify = ifelse(sapply(x, is.numeric), numjust, charjust),
decimal.mark = getOption("OutDec"),
colwidth = NA,
paralign = "top",
na = "",
verbatim = ifelse(sapply(x, is.numeric), TRUE, FALSE),
escape = "#",
reserve = TRUE,
trim = TRUE,
source = NULL,
file = NULL,
source.label = "source: ",
file.label = "file: ",
basefile = FALSE,
tabularEnvironment = "tabular",
footnote.size = "tiny",
...
)
## S3 method for class 'table'
as.tabular(x, ...)
## S3 method for class 'matrix'
as.tabular(x, ...)
Arguments
x |
object |
... |
passed arguments |
rules |
numeric; will be recycled to length 3. indicates number of horizontal lines above and below the header, and below the last row. |
walls |
numeric, recycled to length 2. Number of vertical lines on left and right of table. |
grid |
logical, whether to have lines between rows and columns |
rowgroups |
a vector as long as nrow(x), non-repeats trigger horizontal lines |
colgroups |
a vector as long as names(x), non-repeats trigger vertical lines |
rowbreaks |
numeric: a manual way to specify numbers of lines between rows (ignores grid and rowgroups) |
colbreaks |
numeric: a manual way to specify numbers of lines between columns (ignores grid and colgroups) |
rowgrouprule |
number of lines to set off row group column, if rowgroups supplied as character |
colgrouprule |
number of lines to set off col group header, if colgroups supplied as character |
rowcolors |
character vector of color names, recycled as necessary to color all rows (NULL: no color) |
rowgrouplabel |
character string (at least one character) to label rowgroup column |
charjust |
default justification for character columns |
numjust |
default justification for numeric columns |
justify |
manual specification of column justifications: left, right, center, or decimal (vector as long as ncol(x)) |
decimal.mark |
passed to |
colwidth |
manual specification of column width. (vector of length ncol(x).) Overrides |
paralign |
used with colwidth to align paragraphs: top, middle, or bottom. |
na |
string to replace NA elements |
verbatim |
whether to use verbatim environment for numeric fields. Makes sense for decimal justification; interacts with |
escape |
symbol used by ‘verb’ command as delimiter. A warning is issued if it is found in non-NA text. |
reserve |
substitute escape sequences for LaTeX reserved characters |
trim |
passed to the format command: true by default, so that alignment is the responsibility of just the tabular environment arguments |
source |
optional source attribution |
file |
optional file name |
source.label |
optional text to preceed source if specified |
file.label |
optional text to preceed file if specified |
basefile |
if TRUE, strip path from file for display purposes |
tabularEnvironment |
default |
footnote.size |
font size for source and file attributions |
Value
tabular
Methods (by class)
-
as.tabular(data.frame)
: data.frame method -
as.tabular(table)
: table method -
as.tabular(matrix)
: matrix method
See Also
Examples
as.tabular(head(Theoph))
as.tabular(table(1:3,4:6))
as.tabular(head(Theoph,source='foo/bar',footnote.size='huge'))
## Not run: as.pdf(head(Theoph))