df_style<- {colorDF}R Documentation

Get or set style of a colorful data frame

Description

Get or set style of a colorful data frame

Usage

df_style(x, element = NULL) <- value

df_style(x, element)

Arguments

x

a colorful data frame

element

element or elements of the style

value

one or more values to set

Details

Colorful data frames store the styles in the .style attribute of the data frame object. This attribute is a list with a number of keywords:

Value

df_style(x) returns a list. Assignment results in a data frame with a modified style.

Formatting styles

Each formatting style is a list describing style of the formatting and coloring the text elements. Following elements of that list are recognized:

See Also

print.colorDF() on printing options; col_type() for column types.

Examples

df <- as.colorDF(mtcars)

## row names should be red on yellow background (yikes!)
df_style(df, "row.names") <- list(fg="red", bg="#FFFF00")

## you can use `$` to access the elements
## here, show significant p-values in green
df_style(df)$type.styles$pval$fg_sign <- "green"

## example of assigning multiple values in one assignment:
df_style(df) <- list(interleave=list(fg="#FFFFFF", bg="blue"),
                  row.names=list(fg="blue", bg="#FFFF00"), 
                  col.names=list(bg="#FFFFFF", fg="#FF00FF", 
                                 decoration=c("bold", "italic")))


[Package colorDF version 0.1.7 Index]