matrix2latex | R Documentation |
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.
matrix2latex(M, one_line = TRUE, print = TRUE, ret = !print)
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 |
If ret = TRUE
, the LaTeX code to represent the matrix.
If print = TRUE
, the code is printed to the screen using message
.
m <- datasets::iris[1:5, 1:4]
matrix2latex(m)
tex <- matrix2latex(m, print = FALSE)
print(tex)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.