print_matrix {oeli}R Documentation

Print (abbreviated) matrix

Description

This function prints a (possibly abbreviated) matrix.

Usage

print_matrix(
  x,
  rowdots = 4,
  coldots = 4,
  digits = 2,
  label = NULL,
  simplify = FALSE,
  details = !simplify
)

Arguments

x

A numeric or character (vector or matrix).

rowdots

An integer, the row number which is replaced by .... By default, rowdots = 4.

coldots

An integer, the column number which is replaced by .... By default, coldots = 4.

digits

An integer, the number of printed decimal places. Only relevant if input x is numeric. By default, digits = 2.

label

A character, a label for x. Only printed if simplify = FALSE. By default, label = NULL, i.e., no label.

simplify

A logical, set to TRUE to simplify the output. By default, simplify = FALSE.

details

A logical, set to TRUE to print the type and dimension of x. By default, details = !simplify.

Value

Invisibly returns x.

References

This function is a modified version of ramify::pprint().

Examples

print_matrix(x = 1, label = "single numeric")
print_matrix(x = LETTERS[1:26], label = "letters")
print_matrix(x = 1:3, coldots = 2)
print_matrix(x = matrix(rnorm(99), ncol = 1), label = "single column matrix")
print_matrix(x = matrix(1:100, nrow = 1), label = "single row matrix")
print_matrix(x = matrix(LETTERS[1:24], ncol = 6), label = "big matrix")
print_matrix(x = diag(5), coldots = 2, rowdots = 2, simplify = TRUE)


[Package oeli version 0.5.2 Index]