Creates from a vector, a matrix, an array, or a table, an HTML representation of it. The HTML representation has one column and one row more than the data. The additional row and column are used in order to have a title (top left), the column names (top), and the row names (left).
You can set the style attributes (<td style="...">) via hm_cell, hm_title, hm_col, and hm_row.
For example: hm_cell(hm, 1, 1, text_align="right") will lead to (<td style="text-align:right;">) for the cell (1,1), and any
unnamed element will change the cell value.
Note: since - is an operator in R, we use _ instead. Of course, someone could use "text-align"="right", but I am lazy.
html_matrix(x, ...)# S3 method for default
html_matrix(
x,
...,
byrow = FALSE,
numeric = list(text_align = "right"),
integer = list(text_align = "right"),
char = list(text_align = "left"),
logical = list(text_align = "right"),
border = "#999999"
)
html_mx(x, ...)
Returns an html_matrix.
vector, matrix, array, table or html_matrix: input.
further parameters
logical: creates a row or column matrix if x is one-dimensional (default: FALSE)
list: of HTML style properties for a cell if class(x[i,j])=="numeric" (default: list(text_align="right"))
list: of HTML style properties for a cell if class(x[i,j])=="integer" (default: list(text_align="right"))
list: of HTML style properties for a cell if class(x[i,j])=="character" (default: list(text_align="left"))
list: of HTML style properties for a cell if class(x[i,j])=="logical" (default: list(text_align="right"))
character: vector of background color for a border cell (default: "#999999"))
m <- matrix(1:6, ncol=2)
m
l <- html_matrix(m)
l
Run the code above in your browser using DataLab