View source: R/index_to_sprinkle.R
index_to_sprinkle | R Documentation |
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.
index_to_sprinkle(
x,
rows = NULL,
cols = NULL,
fixed = FALSE,
part = c("body", "head", "foot", "interfoot"),
recycle = c("none", "rows", "cols", "columns"),
coll = NULL
)
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 |
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. :)
Return the indices of the intersection of rows
and cols
If rows = NULL
, assume all rows.
If rows
is an expression where no values resolve to
TRUE
, return x
unchanged.
If any value in rows
is not a valid row in the table,
cast an error.
If cols = NULL
, assume all columns.
If any value in cols
does not identify a column in the table,
cast an error.
If fixed = TRUE
, length(rows)
(or sum(rows),
if an expression
) and cols
must have the same length.
Cast an error if fixed
is not a logical(1)
Cast an error if part
is not one of "body"
,
"head"
, "foot"
, or "interfoot"
.
Benjamin Nutter
sprinkle
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.