View source: R/apply_style.bare.R
apply_style | R Documentation |
Apply a style to assign graphical properties to table elements. This is an internal function not intended to be called by package users.
apply_style(x, style, replace, setEnabled, unstyled, base_style)
x |
A data frame containing table elements (entries, hvrules, or blocks). |
style |
A |
replace |
If FALSE only graphical properties not already present as columns in
|
setEnabled |
If TRUE then column |
unstyled |
Character string indicating how to handle elements for which |
base_style |
A |
Table elements include entries, blocks, and hvrules. If x
contains
table entries, the element_type
for style
should be "entry".
If x
contains table blocks, element_type
may be either
"block" or "hvrule". In the latter case a set of hvrules will be
generated, one for each of the four sides of each block. Then
style
will be used to assign graphical properties to those hvrules.
The graphical properties available for an element, and their types, are
defined in function grSpecs
and documented in ?elements
.
See styleObj
for information about how a style is specified, and
how it is applied to elements. Note that individual style specifications
(rows) in style
are applied to x
in order. If an element
matches more than one style
row, the last matching row will
override the earlier ones.
NA values after evaluating condition
expressions in a style:
styleObj
objects contain contain character fields that are
evaluated as expressions with respect to columns of x
. The fields
are called condition
for entry and block styles, and
block_condition
and adjacent_condition
for hvrule styles.
Each expression must evaluate to a logical scalar or vector with one value
per row of x
. If an expression evaluates to NA for a row of
x
it is treated as FALSE for that row–the reason to not throw an
error is to make it easier to manually add blocks or hvrules by position
only. (Note that this is different from the case where the condition
expression itself, before evaluation, is NA. The latter is treated as
evaluating to TRUE for all rows of x
.)
A data frame. It has one row per table element and the same columns as
x
, plus additional or updated columns containing the graphical
properties to use for each element, plus a column style_row
(the
number of the last row in style
that the entry matched, or NA if it
matched none).
styleObj
; grSpecs
, apply_scale
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.