propsd-setter: Update Graphical Properties for Selected Table Elements

Description Usage Arguments Details Value See Also Examples

Description

Update the graphical properties for table elements selected based on the values of element descriptors.

Usage

1
propsd(x, subset=NULL, setEnabled=TRUE) <- value

Arguments

x

A pltdTable object containing a plotted table.

subset

An expression that when evaluated gives a logical vector indicating which elements should be updated; missing values are taken as FALSE. See DETAILS.

setEnabled

Logical scalar. If TRUE then any element whose properties are updated by this function will have its enabled value set to TRUE (and thus will be displayed in a plot). enabled will not be changed for elements that are not updated. If setEnabled is FALSE, enabled is not changed for any elements.

value

An element_entry, element_refmark, element_hvrule, or element_block object that contains the new values for graphical properties.

Details

There are three similar functions that can be used to modify the graphical properties of table elements: props<-, propsa<-, and propsd<-. They differ only in how one specifies which elements are to be modified. props<- uses element or block ID's, or searches the text content of entries. propsa<- uses explicit row and column numbers within the augmented row-column grid. propsd<- uses the values of element descriptors (as described in ?elements).

The type of elements that are updated is determined by value: if value is an element_entry or element_refmark object then entries are updated; if it is an element_hvrule object then hvrules are; if it is an element_block object then blocks are. See the documentation for props<- for discussion of their use.

Internally entries, hvrules, and blocks are represented as data frames, with one row per element, and columns describing their content, position, and structural role in the table. (See ?elements for a list of the descriptor columns for each type of element.) Argument subset is an expression involving those columns that evaluates to a logical vector; the elements for which this vector is TRUE will be selected. (NA in the logical vector is treated as FALSE.) Thus the subset argument works in the same way as R's built-in subset function to select rows from a data frame. For example subset=(part=="body" & type=="numeric") will update graphical properties for all entries in the table body that have been tagged as representing numbers. And subset=(direction=="hrule") will update graphical properties for horizontal rules but not vertical rules.

To update every element (of the type implied by value) in the table, set subset=TRUE. To update just the currently enabled elements, set subset=enabled.

Note: Standard processing generates hvrules for all four sides of every block in the table. Since generally one doesn't want to display the blocks themselves nor most of those hvrules, they are all disabled by default. Therefore if using subset=TRUE when updating hvrules or blocks, also set setEnabled to FALSE to avoid enabling and displaying them all.

This function overrides graphical properties in x that may have been set by a style. Therefore the value of style_row is set to NA for any elements whose graphical properties are updated by this function.

Value

An object like x, with updated graphical properties for the selected elements.

See Also

element_entry, element_refmark, element_hvrule, element_block, elements, props<-, propsa<-

Examples

1
2
3
4
5
6
7
8
9
ttbl <- textTable(iris2_tab, title="The iris data", 
                  subtitle=c("Summary statistics by species"), 
                  foot="sd = standard deviation")
plt <- plot(ttbl)
propsd(plt, subset=(enabled)) <- element_hvrule(color="red")
propsd(plt, subset=(part == "colhead" & headlayer == 1)) <- 
  element_entry(angle=90, hjust=0.5, vjust=0.5)
plt
  

tablesgg documentation built on June 3, 2021, 1:06 a.m.