Description Usage Arguments Value See Also Examples
Applies conditional formatting databars to one or more columns in a
DT::datatable()
.
1 | format_databars(table, columns, color = "Pastel1", min_quantile = 0.1)
|
table |
an object from |
columns |
columns to be formatted (can be character or a formula of the
form |
color |
Background colors for each column (recycled if needed). One of:
|
min_quantile |
Controls the minimum length of the databar. The row with
the maximum value in a column will always have a full bar. The row with the
minimum value will have a zero-length bar, if |
Formatted DT::datatable
object
datatable_EZ
, datatable
,
formatStyle
, styleColorBar
1 2 3 4 5 6 7 8 9 10 11 12 | dt <- iris %>% datatable_EZ()
# multiple columns specification
# same as c("Sepal.Length","Petal.Length")
dt %>% format_databars(~ Sepal.Length + Petal.Length)
# Specify R color names
dt %>% format_databars(~ Sepal.Length, color=c("red3","grey75"))
# Specify RColorBrewer qualitative palettes
dt %>% format_databars(~ Sepal.Length, color= "Pastel1") # by name
dt %>% format_databars(~ Sepal.Length, color= 2) # by index
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.