Learn R Programming

condformat (version 0.10.0)

rule_fill_bar: Fill column with a bar of a length proportional to a value

Description

Fills the background of a column cell using a bar proportional to the value of the cell

Usage

rule_fill_bar(
  x,
  columns,
  expression,
  low = "darkgreen",
  high = "white",
  background = "white",
  na.value = "gray",
  limits = NA,
  lockcells = FALSE
)

Value

The condformat_tbl object, with the added formatting information

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

an expression to be evaluated with the data. It should evaluate to a numeric vector, that will be used to determine the colour gradient level.

low

Colour for the beginning of the bar

high

Colour for the end of the bar

background

Background colour for the cell

na.value

Colour for missing values

limits

range of limits that the gradient should cover

lockcells

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

See Also

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

Examples

Run this code
data(iris)
cf <- condformat(iris[c(1:5, 70:75, 120:125), ]) %>% rule_fill_bar("Sepal.Length")
if (FALSE) {
print(cf)
}

Run the code above in your browser using DataLab