matrix2latex: Convert matrix to LaTeX equation

Description Usage Arguments Author(s) Examples

View source: R/matrix2latex.R

Description

This function provides a soft-wrapper to xtable::xtableMatharray() with support for fractions output and square brackets.

Usage

1
matrix2latex(x, fractions = FALSE, brackets = TRUE, ...)

Arguments

x

a matrix

fractions

logical; if TRUE, try to express non-integers as rational numbers

brackets

logical; include square brackets around the matricies?

...

additional arguments passed to xtable::xtableMatharray()

Author(s)

Phil Chalmers

Examples

1
2
3
4
5
6
7
8
A <- matrix(c(2, 1, -1,
             -3, -1, 2,
             -2,  1, 2), 3, 3, byrow=TRUE)
b <- c(8, -11, -3)

matrix2latex(cbind(A,b))
matrix2latex(cbind(A,b), digits = 0)
matrix2latex(cbind(A/2,b), fractions = TRUE)

matlib documentation built on May 30, 2017, 1:49 a.m.