xm: Convert a matrix to LaTeX code.

Description Usage Arguments Value Author(s) Examples

View source: R/texcode.r

Description

Convert a matrix to LaTeX code.

Usage

1
2
3
xm(x, digits = NA, mtype = NA, round = NA, na = NA)

xmt(x, digits = NA, mtype = NA, round = NA, na = NA)

Arguments

x

A matrix object.

digits

Number of digits to display (if matrix is numeric).

mtype

LaTeX matrix type, i.e. round braces, curly braces etc. Available types are "matrix", "pmatrix", "bmatrix", "Bmatrix", "vmatrix", "Vmatrix", "bordermatrix".

round

Logical. Round numbers? If not numbers are trimmed only.

na

How to replace NA values? (default is "").

Value

Object of class texcode.

Author(s)

Mark Heckmann

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
m <- matrix(1:9, ncol=3)
xm(m)

# change digits

"$" %% xm(m) %% "$"

"$" + xm(m) + "$"

# matrix types
x <- matrix(1:4, 2)
xm(x, mtype="matrix")
xm(x, mtype="bmatrix")

rownames(x) <- letters[1:2]
colnames(x) <- LETTERS[1:2]
xm(x, mtype="bordermatrix")

markheckmann/mat2tex documentation built on May 21, 2019, 12:06 p.m.