huxtable (version 4.4.0)

escape_contents: Escape cell contents

Description

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

Usage

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

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, which is TRUE.

row

A row specifier. See rowspecs for details.

col

An optional column specifier.

fn

A mapping function. See mapping-functions for details.

byrow

Deprecated. Use by_cols() instead.

Value

For escape_contents, the escape_contents property. For set_escape_contents and map_escape_contents, the modified huxtable.

Examples

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

jams2 <- set_escape_contents(jams,
      TRUE)
escape_contents(jams2)

jams3 <- set_escape_contents(jams,
      2:3, 1, TRUE)
escape_contents(jams3)

jams4 <- map_escape_contents(jams,
      by_rows(
        TRUE,
        FALSE)
      )
escape_contents(jams4)
# }

Run the code above in your browser using DataCamp Workspace