Skip to contents

(Deprecated) Print a matrix, allowing fractions or LaTeX output

Usage

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

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

Value

The formatted matrix

See also

Examples

A <- matrix(1:12, 3, 4) / 6
printMatrix(A, fractions=TRUE)
#> Warning: Function is deprecated. See latexMatrix() and Eqn() for more recent approaches
#>      [,1] [,2] [,3] [,4]
#> [1,]  1/6  2/3  7/6  5/3
#> [2,]  1/3  5/6  4/3 11/6
#> [3,]  1/2    1  3/2    2
printMatrix(A, latex=TRUE)
#> Warning: Function is deprecated. See latexMatrix() and Eqn() for more recent approaches
#> Warning: Function is deprecated. See latexMatrix() and Eqn() for more recent approaches
#> \left[
#>  \begin{array}{rrrr}
#>   0.16666667 & 0.66666667 & 1.16666667 & 1.66666667 \\ 
#>   0.33333333 & 0.83333333 & 1.33333333 & 1.83333333 \\ 
#>   0.50000000 & 1.00000000 & 1.50000000 & 2.00000000 \\ 
#>   \end{array} \right]