View source: R/data.frame.to.html.table.string.R
data.frame.to.html.table.string | R Documentation |
Output the contents of a numeric matrix or dataframe into html table notation string
data.frame.to.html.table.string(
dframe,
class = NA,
topLeft = "",
cellFormat = function(i, j, cell, dataFrame) {
if (i == 0) {
tmp <-
paste("<th>", cell, "</th>", sep = "")
}
else {
tmp <-
paste("<td>", cell, "</td>", sep = "")
}
return(tmp)
}
)
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 |
cellFormat |
A function that will convert the cell content to a latex compatible string. The function has to accept three arguments, row, column, cell and a dataFrame variable 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). The cell value is the value of the cell, the dataFrame variable allows to see if the entry is the maximum in the row etc. |
header |
A boolean toggle. If true a full latex table with begintable etc is created, if false only cells are converted. |
A vector of strings where each entry is one line of html code.
n <- 3
m <- 6
M1 <- matrix(1:(n*m),n,m)
rownames(M1) <- 1:n
colnames(M1) <- 1:m
S1 <- data.frame.to.html.table.string(M1,topLeft="TL")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.