Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

by_regex

Map cells matching a string or regex to cell properties


Description

Map cells matching a string or regex to cell properties

Usage

by_regex(..., .grepl_args = list(), ignore_na = TRUE)

Arguments

...

A list of name-value pairs. The names are regular expressions. If there is a single unnamed argument, this is the default value for unmatched cells. More than one unnamed argument is an error.

.grepl_args

A list of arguments to pass to grepl(). Useful options include fixed, perl and ignore.case.

ignore_na

If TRUE, NA values in the result will be left unchanged from their previous values. Otherwise, NA normally resets to the default.

Value

A function for use in map_*** functions.

See Also

Other mapping functions: by_cases(), by_colorspace(), by_function(), by_quantiles(), by_ranges(), by_rows(), by_values()

Examples

ht <- hux(c("The cat sat", "on the", "mat"))

map_bold(ht, by_regex("at" = TRUE))
map_bold(ht, by_regex("a.*a" = TRUE))

map_bold(ht, by_regex(
        "the" = TRUE,
        .grepl_args = list(
          ignore.case = TRUE
        )
      ))

huxtable

Easily Create and Style Tables for LaTeX, HTML and Other Formats

v5.3.0
MIT + file LICENSE
Authors
David Hugh-Jones [aut, cre]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.