| index_to_sprinkle {pixiedust} | R Documentation |
Determine the Indices to Sprinkle
Description
The sprinkle methods accept the rows and columns that are
to be modified as matrix coordinates. The dust object stores
the table data in a long form. The tabular coordinates are translated
into row indices using this function.
Usage
index_to_sprinkle(
x,
rows = NULL,
cols = NULL,
fixed = FALSE,
part = c("body", "head", "foot", "interfoot"),
recycle = c("none", "rows", "cols", "columns"),
coll = NULL
)
Arguments
x |
An object of class |
rows |
Either a numeric vector of rows in the tabular object to be
modified or an object of class |
cols |
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. |
fixed |
|
part |
|
recycle |
|
coll |
An optional |
Details
When fixed = FALSE, 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.
The value of recycle 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). "cols"
and "columns" have the same effect. The two choices to specify
are motivated by the fact that I sometimes get confused about which
it should be. :)
Functional Requirements
Return the indices of the intersection of
rowsandcolsIf
rows = NULL, assume all rows.If
rowsis an expression where no values resolve toTRUE, returnxunchanged.If any value in
rowsis not a valid row in the table, cast an error.If
cols = NULL, assume all columns.If any value in
colsdoes not identify a column in the table, cast an error.If
fixed = TRUE,length(rows)(orsum(rows), if an expression) andcolsmust have the same length.Cast an error if
fixedis not alogical(1)Cast an error if
partis not one of"body","head","foot", or"interfoot".
Author(s)
Benjamin Nutter
See Also
sprinkle