Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

RowFactor

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 x.

texify

If TRUE, characters that would be interpreted specially by LaTeX are escaped (using latexTranslate) so they will print properly.

expr

The expression to use in evaluating the factor. Generally the same as the expression passed as x, but internal uses may differ.

override

Should the name for the factor override any previously specified Heading() setting?

spacing

Extra spacing will be added before every spacing lines.

space

How much extra space to add, in ex units.

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 ))

tables

Formula-Driven Table Generation

v0.9.6
GPL-2
Authors
Duncan Murdoch
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.