zebra: Apply Zebra Striping to an HTML Matrix

View source: R/zebra.R

zebraR Documentation

Apply Zebra Striping to an HTML Matrix

Description

This function applies alternating background colors (zebra striping) to an html_matrix object, either by rows or by columns.

Usage

zebra(x, col = c("#FFFFFF", "#CCCCCC"), byrow = TRUE)

Arguments

x

An html_matrix object to which the zebra striping will be applied.

col

A character vector of colors to use for striping. Defaults to c("#FFFFFF", "#CCCCCC").

byrow

Logical; if TRUE, colors are applied to rows, otherwise to columns. Default is TRUE.

Value

An html_matrix object with updated background colors.

Examples

library("magrittr")
m  <- matrix(1:12, ncol = 4)
hm <- html_matrix(m) %>% zebra()
html <- toHTML(hm, browser = TRUE)


exams.forge documentation built on Aug. 21, 2025, 5:41 p.m.