xm: Convert a matrix to LaTeX code.

View source: R/texcode.r

xmR Documentation

Convert a matrix to LaTeX code.

Description

Convert a matrix to LaTeX code.

Usage

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

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 July 29, 2023, 7:45 p.m.