lazy.matrix: Convert Matrix to LaTeX Table

Description Usage Arguments Details Author(s) Examples

View source: R/lazy.matrix.R

Description

An example of using lazyWeave to produce tables

Usage

1
2
3
4
lazy.matrix(x, align = "center", justify = "center", rcol = NULL,
  usecol = "lightgray", caption = NULL, footnote = NULL,
  placement = "h", translate = TRUE, cat = getOption("lazyWeave_cat"),
  ...)

Arguments

x

A matrix. Other objects are coerced to matrices

align

Character vector or string giving the alignment for each column of the table. Options are "left", "center", "right".

justify

Character string giving the alignment for the table on the page. Options are "left", "center", "right".

rcol

A vector giving the rows of x to be colored

usecol

A character string or vector denoting the color of the rows in rcol

caption

Caption for the table. This is printed above the table

footnote

Additional footnotes for the table. These are printed below the table.

placement

Controls the placement of the figure. Options are "ht", "t", "b", "p", "H" and can be supplemented with "!". See "Details" for more explanation. These apply only to LaTeX

translate

Toggles if inputs in x should be passed through latexTranslate. This should be set to FALSE if writing custom code

cat

Logical. Determines if the output is returned as a character string or returned via the cat function (printed to console). The default value is set by options()$lazyWeave_cat. This argument allows for selective override of the default.

...

Additional arguments to be passed to lazy.table

Details

The output for lazy.matrix is highly inflexible compared to lazy.table. It is an example of how to build a reproducible table with a certain formatting style that may be used again and again for consistency.

Row names are always left justified. This cannot be changed.

placement options are used as follows:

ht Place the float here, i.e., approximately at the same point it occurs
t Position at the top of the page
b Position at the bottom of the page
p Put on a special page for floats only
H Places the float at precisely the location in the LaTeX code. Requires the float package

The "!" may be used after any of these in order to override LaTeX float rules and force your selection. More can be learned by reading about floats in a LaTeX manual

Author(s)

Benjamin Nutter

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Not run: 
lazy.write(
  lazy.file.start(),
  lazy.text("The mtcars dataset describes a number of vehicles.  
      Let's take a look at the data"),
  lazy.matrix(mtcars, rcol=(1:nrow(mtcars))[c(FALSE, TRUE)]),
  lazy.file.end(),
  OutFile="Example 1.tex")

unlink("Example 1.tex")

## End(Not run)

nutterb/lazyWeave documentation built on May 24, 2019, 10:52 a.m.