For an element
object, some fields are
vectorized, while others are not. This function allows you to apply a
function to the vectorized fields.
The following helper functions are available:
element_rep
: Appliesrep()
.element_rep_len
: Appliesrep_len()
.element_vec_recycle
: Appliesvec_recycle()
.element_vec_rep
: Appliesvec_rep()
.element_vec_rep_each
: Appliesvec_rep_each()
.element_vec_slice
: Appliesvec_slice()
.
Usage
element_vec(.el, .fn, ...)
element_rep(.el, ...)
element_rep_len(.el, length.out, ...)
element_vec_recycle(.el, size, ...)
element_vec_rep(.el, times, ...)
element_vec_rep_each(.el, times, ...)
element_vec_slice(.el, i, ...)
Arguments
- .el
An
element
object.- .fn
The function to be applied to the vectorized fields of the element object.
- ...
Additional arguments passed on to
fn
.- length.out
Non-negative integer. The desired length of the output vector. Other inputs will be coerced to a double vector and the first element taken. Ignored if
NA
or invalid.- size
Desired output size.
- times
For
vec_rep()
, a single integer for the number of times to repeat the entire vector.For
vec_rep_each()
, an integer vector of the number of times to repeat each element ofx
.times
will be recycled to the size ofx
.- i
An integer, character or logical vector specifying the locations or names of the observations to get/set. Specify
TRUE
to index all elements (as inx[]
), orNULL
,FALSE
orinteger()
to index none (as inx[NULL]
).