rule_css {condformat}R Documentation

Apply a CSS style property as a conditional formatting rule

Description

Apply a CSS style property as a conditional formatting rule

Usage

rule_css(x, columns, expression, css_field, na.value = "", lockcells = FALSE)

Arguments

x

A condformat object, typically created with condformat()

columns

A character vector with column names to be coloured. Optionally tidyselect::language() can be used.

expression

This expression should evaluate to an array of the values

css_field

CSS style property name (e.g. "color")

na.value

CSS property value to be used in missing values (e.g. "grey")

lockcells

logical value determining if no further rules should be applied to the affected cells.

See Also

Other rule: rule_fill_bar(), rule_fill_discrete(), rule_fill_gradient2(), rule_fill_gradient(), rule_text_bold(), rule_text_color()

Examples

data(iris)
cf <- condformat(iris[c(1:5, 51:55, 101:105),]) %>%
  rule_css(Species, expression = ifelse(Species == "setosa", "red", "darkgreen"),
           css_field = "color")
## Not run: 
print(cf)

## End(Not run)

[Package condformat version 0.10.1 Index]