Text can be made to stand out (or fade away) by using font features such as bold and italic text, color, size, or different fonts.
sprinkle_font(
x,
rows = NULL,
cols = NULL,
bold = NULL,
italic = NULL,
font_size = NULL,
font_size_units = NULL,
font_color = NULL,
font_family = NULL,
...,
part = c("body", "head", "foot", "interfoot", "table"),
fixed = FALSE,
recycle = "none"
)# S3 method for default
sprinkle_font(
x,
rows = NULL,
cols = NULL,
bold = NULL,
italic = NULL,
font_size = NULL,
font_size_units = NULL,
font_color = NULL,
font_family = NULL,
...,
part = c("body", "head", "foot", "interfoot", "table"),
fixed = FALSE,
recycle = "none"
)
# S3 method for dust_list
sprinkle_font(
x,
rows = NULL,
cols = NULL,
bold = NULL,
italic = NULL,
font_size = NULL,
font_size_units = NULL,
font_color = NULL,
font_family = NULL,
...,
part = c("body", "head", "foot", "interfoot", "table"),
fixed = FALSE,
recycle = "none"
)
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.
logical(1) indicating if the text in the selected cells
should be made bold.
logical(1) indicating if the text in the selected
cells should be made italic.
numeric(1) giving the font size.
character(1) giving the units of the font
size. May be any of c("px", "pt", "%", "em"). LaTeX output only
recognizes "pt" and "em". For LaTeX output, "px" is
quietly changed to "pt" when printing.
character(1) giving a valid color name for the
text.
character(1) giving the font name for the text.
This is only recognized in HTML output.
Additional arguments to pass to other methods. Currently ignored.
A character string denoting which part of the table to modify.
logical(1) indicating if the values in rows
and cols should be read as fixed coordinate pairs. By default,
sprinkles are applied at the intersection of rows and cols,
meaning that the arguments do not have to share the same length.
When fixed = TRUE, they must share the same length.
A character one that determines how sprinkles are
managed when the sprinkle input doesn't match the length of the region
to be sprinkled. By default, recycling is turned off. Recycling
may be performed across rows first (left to right, top to bottom),
or down columns first (top to bottom, left to right).
Correctly change the bold column of the table part for
the selected cells.
Correctly change the italic column of the table part for
the selected cells.
Correctly change the font_size column of the table part for
the selected cells.
Correctly change the font_size_units column of the table part for
the selected cells.
Correctly chagne the font_color column of the table part
for the selected cells.
Correctly change the font_family column of the table part for
the selected cells.
Cast an error if x is not a dust object.
Cast an error if bold is not logical(1)
Cast an error if italic is not logical(1)
Cast an error if font_size is not numeric(1)
Cast an error if font_size_units is not character(1)
Cast an error if font_size_units is not one of
px, pt, em, or
Cast an error if font_color is not character(1)
Cast an error if font_family is not character(1)
Cast an error if part is not a subset of c("body",
"head", "foot", "interfoot")
Cast an error if recycle = "none" and bold
does not have length 1.
Cast an error if recycle = "none" and italic
does not have length 1.
Cast an error if recycle = "none" and font_size
does not have length 1.
Cast an error if recycle = "none" and font_size_units
does not have length 1.
Cast an error if recycle = "none" and font_color
does not have length 1.
Cast an error if recycle = "none" and font_family
does not have length 1.
The functional behavior of the fixed and recycle arguments
is not tested for this function. It is tested and validated in the
tests for index_to_sprinkle.
Benjamin Nutter
The bold and italic features are recognized by all
formats.
Font size features are recognized by HTML and LaTeX. LaTeX only recognizes
the font size unit options of "pt" and "em", but will quietly
change "px" to "pt" when printing.
Font color features are recognized by HTML and LaTeX.
Font family is only recognized by HTML.
sprinkle