colourTable: Conditionally formatted table

Description Usage Arguments Value See Also Examples

View source: R/coin_resultsdash.R

Description

Given a data frame, generates a conditionally-formatted html table using reactable. This function is used by iplotTable(). It is a quick wrapper for reactable::reactable.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
colourTable(
  df,
  freeze1 = TRUE,
  sortcol = NULL,
  sortorder = "desc",
  searchable = TRUE,
  pagesize = 10,
  cell_colours = NULL,
  reverse_colours = FALSE
)

Arguments

df

A data frame to be displayed as a table.

freeze1

If TRUE (default), freezes the first column. This may be for example the unit name or code.

sortcol

A column name to sort the table by. Defaults to first numerical column. Set to "none" to disable.

sortorder

Either "desc" for sorted column to be sorted from high to low (default) or "asc" for the opposite.

searchable

If TRUE, includes a search box

pagesize

The number of rows to display on each page.

cell_colours

A character vector of at least two colour codes (e.g. Hex codes) to use for the colour palette. Should be in order of low to high values. Defaults to a simple green palette of c("#eefff4", "#358554"). See grDevices::colorRamp() for more info.

reverse_colours

If TRUE, reverses the colour map - useful for rank tables where lowest numbers mean high scores.

Value

An interactive table generated by reactable.

See Also

Examples

1
2
3
4
5
6
7
8
# some random data
df <-  as.data.frame(matrix(runif(12), 3, 4))
# a names column
df <- cbind(Rnames = letters[1:3], df)
# round it
df <- roundDF(df)
# make a table
colourTable(df)

COINr documentation built on Nov. 30, 2021, 9:06 a.m.