vec_unchop() has been renamed to list_unchop() and is deprecated as of
vctrs 0.5.0.
Usage
vec_unchop(
x,
indices = NULL,
ptype = NULL,
name_spec = NULL,
name_repair = c("minimal", "unique", "check_unique", "universal")
)Arguments
- x
A vector
- indices
For
vec_chop(), a list of positive integer vectors to slicexwith, orNULL. Can't be used ifsizesis already specified. If bothindicesandsizesareNULL,xis split into its individual elements, equivalent to using anindicesofas.list(vec_seq_along(x)).For
list_unchop(), a list of positive integer vectors specifying the locations to place elements ofxin. Each element ofxis recycled to the size of the corresponding index vector. The size ofindicesmust match the size ofx. IfNULL,xis combined in the order it is provided in, which is equivalent to usingvec_c().- ptype
If
NULL, the default, the output type is determined by computing the common type across all elements ofx. Alternatively, you can supplyptypeto give the output a known type.- name_spec
A name specification for combining inner and outer names. This is relevant for inputs passed with a name, when these inputs are themselves named, like
outer = c(inner = 1), or when they have length greater than 1:outer = 1:2. By default, these cases trigger an error. You can resolve the error by providing a specification that describes how to combine the names or the indices of the inner vector with the name of the input. This specification can be:A function of two arguments. The outer name is passed as a string to the first argument, and the inner names or positions are passed as second argument.
An anonymous function as a purrr-style formula.
A glue specification of the form
"{outer}_{inner}".An
rlang::zap()object, in which case both outer and inner names are ignored and the result is unnamed.
See the name specification topic.
- name_repair
How to repair names, see
repairoptions invec_as_names().
Value
vec_chop(): A list where each element has the same type asx. The size of the list is equal tovec_size(indices),vec_size(sizes), orvec_size(x)depending on whether or notindicesorsizesis provided.list_unchop(): A vector of typevec_ptype_common(!!!x), orptype, if specified. The size is computed asvec_size_common(!!!indices)unless the indices areNULL, in which case the size isvec_size_common(!!!x).
