hm_cell {exams.forge}R Documentation

html_mmatrix Modification

Description

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 html_matrix object

row

integer: row(s) to access

col

integer: column(s) to access

...

further elements

byrow

logical: order indices by row or column (default: FALSE)

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")

[Package exams.forge version 1.0.10 Index]