Generate Table Styles

Share:

Description

Based on the current style specifications, create style names for all table elements.

Usage

1
tableStyles(x, useRowNames = TRUE, header = NULL, cgroup = NULL, rgroup = NULL)

Arguments

x

a vector, matrix or data frame. See details below

useRowNames

a logical: should the row names be printed in the final table

header

an optional vector of heading names

cgroup

an optional data frame of group heading names and spans

rgroup

an optional data frame of group row names and spans

Details

Based on the dimensions of x, this function generates table style names for all of the elements. For example, f the data are an nxn matrix, it will create an nxn matrix of style names for the text and the table cells.

The arguments of tableStyles must be consistent with those specified for odfTable, specifically the useRowNames and header arguments.

Once the appropriate set of style names are generated, the user can programatically alter it. For example, based on some logic, cells can have different text colors etc.

The document formatting.odt in the package's examples directory illustrates the process of changing the appearance of the table using tableStyles.

Value

A list of style names with elements: table, text, cell, header, headerCell, cgroupText, cgroupCell, rgroupText and rgroupCell. The text and cell entries are for the non-header table elements.

Author(s)

Max Kuhn

See Also

odfTable

Examples

1
2
3
irisStyles <- tableStyles(iris, useRowNames = TRUE, header = names(iris))
irisStyles$text[2,3] <- "ttRed"
odfTable(iris, useRowNames = TRUE, styles = irisStyles)