matrix2latex: Doc writing: get LaTeX of a matrix

View source: R/all.R

matrix2latexR Documentation

Doc writing: get LaTeX of a matrix

Description

If you are working in RMarkdown and need to write a matrix in LaTeX it can be a pain. This function tries to make it easier.

Usage

matrix2latex(M, one_line = TRUE, print = TRUE, ret = !print)

Arguments

M

a matrix-like object

one_line

logical – whether to return one-line or many

print

logical – print the LaTeX to the screen

ret

logical – return the text so it can be stored in a variable

Value

If ret = TRUE, the LaTeX code to represent the matrix. If print = TRUE, the code is printed to the screen using message.

Examples

m <- datasets::iris[1:5, 1:4]
matrix2latex(m)
tex <- matrix2latex(m, print = FALSE)
print(tex)


adamleerich/alrtools documentation built on March 12, 2024, 11:38 p.m.