huxtable (version 0.3.1)

escape_contents: Escape cell contents

Description

Functions to get or set the escape cell contents property of huxtable table cells.

Usage

escape_contents(ht)
escape_contents(ht) <- value
set_escape_contents(ht, row, col, value, byrow = FALSE)

Arguments

ht

A huxtable.

value

A logical vector or matrix. If TRUE, cell contents will be HTML or LaTeX escaped. Set to NA to reset to the default.

row

A row specifier. See rowspecs for details.

col

An optional column specifier.

byrow

If TRUE, fill in values by row rather than by column.

Value

For escape_contents, the escape_contents attribute. For set_escape_contents, the ht object.

Examples

Run this code
# NOT RUN {
ht <- huxtable(Exponent = 2:4, Example = paste0('$x^', 2:4, '$'))
escape_contents(ht)[,2] <- FALSE

ht <- huxtable(a = 1:3, b = 3:1)
ht2 <- set_escape_contents(ht, TRUE)
escape_contents(ht2)
ht3 <- set_escape_contents(ht, 1:2, 1, TRUE)
escape_contents(ht3)
ht4 <- set_escape_contents(ht, 1:2, 1:2, c(TRUE, FALSE), byrow = TRUE)
escape_contents(ht4)
ht5 <- set_escape_contents(ht, where(ht == 1), TRUE)
escape_contents(ht5)
# }

Run the code above in your browser using DataCamp Workspace