hm_cell {exams.forge} | R Documentation |
html_mmatrix
Modification
Description
-
hm_cell
orhm_index
modify a data cell format (fmt="%s"
), value (unnamed parameter) or style (text_align="left"
) -
hm_col
orhm_row
modify a row or column format (fmt="%s"
), value (unnamed parameter) or style (text_align="left"
) -
hm_title
modifies the title attribute of anhtml_matrix
based on specific arguments -
hm_table
modifies the properties of the entire HTML table within anhtml_matrix
-
hm_tr
modifies the properties of one or more table rows (tr elements) in anhtml_matrix
. Row indices for modification (ind
) can be specified along with additional parameters to customize the row format, values, or style
Usage
hm_cell(x, row = NULL, col = NULL, ..., byrow = FALSE)
hm_index(x, ind, ...)
hm_title(x, ...)
hm_table(x, ...)
hm_row(x, ind, ...)
hm_col(x, ind, ...)
hm_tr(x, ind, ...)
modify_cell(x, row = NULL, col = NULL, ..., byrow = FALSE)
mod_cell(x, row = NULL, col = NULL, ..., byrow = FALSE)
modify_col(x, ind, ...)
mod_col(x, ind, ...)
modify_index(x, ind, ...)
mod_ind(x, ind, ...)
modify_row(x, ind, ...)
mod_row(x, ind, ...)
modify_table(x, ...)
mod_t(x, ...)
modify_title(x, ...)
mod_title(x, ...)
modify_tr(x, ind, ...)
mod_tr(x, ind, ...)
Arguments
x |
an |
row |
integer: row(s) to access |
col |
integer: column(s) to access |
... |
further elements |
byrow |
logical: order indices by row or column (default: |
ind |
integer vector or matrix: has access to various (row and columns) elements (first column: row, second column: column) |
Value
A modified html_matrix
object.
Examples
l <- html_matrix(matrix(1:6, ncol=2))
# replace l[1,1] by NA
hm_cell(l, 1, 1, NA)
# replace l[1,1] by NA and set the text_align to center
hm_cell(l, 1, 1, NA, text_align="center")
# replace l[1,3] and l[2,1] by NA
rcind <- cbind(c(1,3), c(2, 1))
hm_index(l, rcind, NA)
# set a new title
hm_title(l, "new title")
# set a new row or column title
hm_row(l, 2, "row 2")
hm_col(l, 1, "col 1")
# set fmt by column or row
print(hm_cell(l, fmt=c("%.0f", "%.1f", "%.2f"), byrow=FALSE), which="fmt")
print(hm_cell(l, fmt=c("%.0f", "%.1f"), byrow=TRUE), which="fmt")