AddSignificanceHighlightingToDataTable: 'AddSignificanceHighlightingToDataTable'

View source: R/tables.R

AddSignificanceHighlightingToDataTableR Documentation

AddSignificanceHighlightingToDataTable

Description

Add red and blue highlighting to a data table conditionally on the values in a specified column. Used to replicate Q's significance highlighting in the table.

Usage

AddSignificanceHighlightingToDataTable(
  dt,
  columns.to.color,
  column.to.check,
  red.value,
  blue.value
)

Arguments

dt

An HTML widget DataTable created e.g. by DataTableWithRItemFormat

columns.to.color

A character vector containing the column names of the columns that should be colored.

column.to.check

The name of the column whose values will be used to do the coloring.

red.value

A number specifying the upper bound for values in column.to.check which will cause cells in columns.to.color to be highlighted red. That is, when cells in column.to.check have a value less than this, cells in columns.to.color will be colored red.

blue.value

A number specifying the lower bound for coloring cells blue, as above.

Examples

my.df <- data.frame(First = c(1,2,3), Second = c("a", "b", "c"))
my.dt <- DataTableWithRItemFormat(my.df, caption = "A nice table")
my.dt <- AddSignificanceHighlightingToDataTable(my.dt,
    columns.to.color = "Second", column.to.check = "First",
    red.value = 1.01, blue.value = 2.99)


Displayr/flipFormat documentation built on Feb. 26, 2024, 12:37 a.m.