printMat {pnd}R Documentation

Print a matrix with separators

Description

Print a matrix with separators

Usage

printMat(
  x,
  digits = 3,
  shave.spaces = TRUE,
  begin = "",
  sep = "  ",
  end = "",
  print = TRUE,
  format = TRUE
)

Arguments

x

A numeric matrix to print line by line.

digits

Positive integer: the number of digits after the decimal comma to round to (i.e. one less than the number of significant digits).

shave.spaces

Logical: if true, removes spaces to ensure compact output; if false, results in nearly fixed-width output (almost).

begin

A character to put at the beginning of each line, usually "", "(", or "c(" (the latter is useful if console output is used in calculations).

sep

The column delimiter, usually " ", "|", "&" (for LaTeX), or ", ".

end

A character to put at the end of each line, usually "" or ")".

print

If TRUE, outputs the lines of the matrix rows into the console.

format

If FALSE, skips the formatting part.

Value

The same x that was passed as the first input.

Examples

x <- matrix(c(-1234567, 12345.67, 123.4567,
              1.23456, -1.23456e-1, 0,
              1.23456e-4, 1.23456e-2, -1.23456e-6), nrow = 3)
printMat(x)
printMat(x, 2, TRUE, "c(", ", ", ")")  # Ready row vectors

[Package pnd version 0.1.0 Index]