View source: R/data.frame.to.latex.table.string.R
data.frame.to.latex.table.string | R Documentation |
Output the contents of a numeric matrix or dataframe into LaTeX type table notation string
data.frame.to.latex.table.string(
dframe,
topLeft = "",
header = TRUE,
cellFormat = function(i, j, cell) {
return(cell)
}
)
dframe |
A data.frame or matrix |
topLeft |
A string that will fill the top left corner (first cell of the first row) of the table |
header |
A boolean toggle. If true a full latex table with begintable etc is created, if false only cells are converted. |
cellFormat |
A function that will convert the cell content to a latex compatible string. The function has to accept three arguments, row, column and cell value and has to return a string. It is applied to the cells (i,j > 0) and to the margins (i,j = 0) including topLeft which sits at (0,0). |
A vector of strings where each entry is one line of latex code.
n <- 3
m <- 6
M1 <- matrix(1:(n*m),n,m)
rownames(M1) <- 1:n
colnames(M1) <- 1:m
S1 <- data.frame.to.latex.table.string(M1,topLeft="TL")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.