Provides background color striping based on row or column. Striping may be done with any number of colors. The most common use of striping is to provide row discrimination in tables.
sprinkle_bg_pattern(
x,
rows = NULL,
cols = NULL,
bg_pattern = c("transparent", "#DCDCDC"),
bg_pattern_by = c("rows", "cols"),
...,
part = c("body", "head", "foot", "interoot", "table")
)# S3 method for default
sprinkle_bg_pattern(
x,
rows = NULL,
cols = NULL,
bg_pattern = c("transparent", "#DCDCDC"),
bg_pattern_by = c("rows", "cols"),
...,
part = c("body", "head", "foot", "interfoot", "table")
)
# S3 method for dust_list
sprinkle_bg_pattern(
x,
rows = NULL,
cols = NULL,
bg_pattern = c("transparent", "#DCDCDC"),
bg_pattern_by = c("rows", "cols"),
...,
part = c("body", "head", "foot", "interfoot", "table")
)
An object of class dust
Either a numeric vector of rows in the tabular object to be
modified or an object of class call
. When a call
,
generated by quote(expression)
, the expression resolves to
a logical vector the same length as the number of rows in the table.
Sprinkles are applied to where the expression resolves to TRUE
.
Either a numeric vector of columns in the tabular object to be modified, or a character vector of column names. A mixture of character and numeric indices is permissible.
A character vector giving the colors to be iterated in the pattern.
A subset of c("rows", "cols")
, with partial
matching accepted. Only the first value is used, and determines the
direction of the pattern.
Additional arguments to pass to other methods. Currently ignored.
A character string denoting which part of the table to modify.
Correctly reassigns the appropriate elements bg
column
in the table part.
Casts an error if x
is not a dust
object.
Casts an error if bg_pattern
is not a character vector.
Casts an error if any element in bg_pattern
is not a valid
color name.
Casts an error if bg_pattern_by
is not a subset of
c("rows", "columns")
(with partial matching).
Casts an error if part
is not one of "body"
,
"head"
, "foot"
, or "interfoot"
This is a rare sprinkle that doesn't use the fixed
and recycle
arguments. They are assumed to be FALSE
and "none"
,
respectively, in order to pass through index_to_sprinkle
.
sprinkle_bg
, sprinkle
,
index_to_sprinkle