Learn R Programming

matlib (version 0.9.6)

printMatrix: Print a matrix, allowing fractions or LaTeX output

Description

Print a matrix, allowing fractions or LaTeX output

Usage

printMatrix(
  A,
  parent = TRUE,
  fractions = FALSE,
  latex = FALSE,
  tol = sqrt(.Machine$double.eps)
)

Value

The formatted matrix

Arguments

A

A numeric matrix

parent

flag used to search in the parent envir for suitable definitions of other arguments. Set to TRUE (the default) if you want to only use the inputs provided.

fractions

If TRUE, print numbers as rational fractions, using the fractions function; if you require greater accuracy, you can set the cycles (default 10) and/or max.denominator (default 2000) arguments to fractions as a global option, e.g., options(fractions=list(cycles=100, max.denominator=10^4)).

latex

If TRUE, print the matrix in LaTeX format

tol

Tolerance for rounding small numbers to 0

See Also

Examples

Run this code
A <- matrix(1:12, 3, 4) / 6
printMatrix(A, fractions=TRUE)
printMatrix(A, latex=TRUE)

Run the code above in your browser using DataLab