RowFactor {tables} | R Documentation |
Use a variable as a factor to give rows in a table.
Description
The functions take a variable and treat it as a factor in a table.
RowFactor
is designed for LaTeX output, adding extra spacing to
make the table more readable. Multicolumn
also works only in
LaTeX, and displays the label in a style with the level on a line by
itself, spanning multiple columns.
Usage
Factor(x, name = deparse(expr), levelnames = levels(x),
texify = getOption("tables.texify", FALSE),
expr = substitute(x), override = TRUE)
RowFactor(x, name = deparse(expr),
levelnames = levels(x),
spacing = 3, space = 1, suppressfirst = TRUE,
nopagebreak = "\\nopagebreak ",
texify = getOption("tables.texify", FALSE),
expr = substitute(x),
override = TRUE)
Multicolumn(x, name = deparse(expr), levelnames = levels(x),
width=2, first=1, justify="l",
texify = getOption("tables.texify", FALSE),
expr = substitute(x),
override = TRUE)
Arguments
x |
A variable to be treated as a factor. |
name |
The display name for the factor. |
levelnames |
The strings to use as levels of |
texify |
If |
expr |
The expression to use in evaluating the factor. Generally the same
as the expression passed as |
override |
Should the name for the factor override any previously specified
|
spacing |
Extra spacing will be added before every |
space |
How much extra space to add, in |
suppressfirst |
Whether to suppress the spacing in the first group. |
nopagebreak |
LaTeX macro to insert to suppress page breaks except between groups. |
width |
How many columns should the label span? |
first |
Which is the first column in which this label appears? |
justify |
How should the label be justified in the columns? |
Value
Language to insert into the table formula to achieve the desired table.
Examples
tabular( Factor(1:10, "row") ~
All(iris[1:10,])*Heading()*identity )
toLatex( tabular( RowFactor(1:10, "", 5) ~
All(iris[1:10,])*Heading()*identity ))