tableStyles {odfWeave} | R Documentation |
Based on the current style specifications, create style names for all table elements.
tableStyles(x, header = NULL)
x |
a vector, matrix or data frame. See details below |
header |
an optional vector of heading names |
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 value of x
must match the results produced by the odfTable
specifications. For example, if useRowNames
is TRUE
, x
should have an extra column for the row names and an extra entry in the headings. Also, if your data are in a vector, you must convert it to a matrix consistent with the dimensions produced by the horizontal
argument in odfTable
.
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.
a list of style names with elements: table
, text
, cell
, header
and headerCell
. The text
and cell
entries are for the non-header table elements.
Max Kuhn
# this would require useRowNames = FALSE irisStyles <- tableStyles(iris, header = names(iris)) irisStyles$text[2,3] <- "ttRed" odfTable(iris, useRowNames = FALSE, styles = irisStyles)