make_css_color_rank_theme {tableHTML}R Documentation

Get css properties for custom color rank theme

Description

make_css_color_rank_theme will create a list of css properties needed for custom conditional formatting.

Usage

make_css_color_rank_theme(
  column_data,
  colors,
  css_property = "background-color",
  decreasing = FALSE,
  same_scale = TRUE
)

Arguments

column_data

A named list of vectors of values that are in a tableHTML column which should be mapped to a color palette.

colors

colors to interpolate; must be a valid argument to col2rgb().

css_property

Character. An optional character specifying the css attribute that should be used. Default is 'backgroud-color'

decreasing

logical. Should the sort order be increasing or decreasing? For the "radix" method, this can be a vector of length equal to the number of arguments in .... For the other methods, it must be length one.

same_scale

Logical. This flag indicates whether the condition should be applied to columns individually or in conjunction. If TRUE, the condition will be evaluated on all values of all columns. If FALSE, the condition will be evaluated per column.

Details

make_css_color_rank_theme will add conditional css to a tableHTML's columns. add_conditional_css_column will only add css to the columns without the headers or second headers (i.e. it only affects the td tag internally and not the th tag). If you want to add css to the headers or second headers please use add_css_header or add_css_second_header.

Value

A list of css properties

Examples


tableHTML <- tableHTML(mtcars)

css <- make_css_color_rank_theme(list(mpg = mtcars$mpg),
                                 c("orange", "yellow","springgreen","royalblue"))

tableHTML %>% add_css_conditional_column(conditional = "color_rank",
                                        color_rank_theme = "Custom",
                                        color_rank_css = css, column = 1)


[Package tableHTML version 2.1.2 Index]