| Title: | Assign Vectors Elements to Separate Variables |
|---|---|
| Description: | Syntactic sugar to allow unpacking elements from a vector into separate variables in a single assignment expression. |
| Authors: | Konrad Rudolph [aut, cre] (ORCID: <https://orcid.org/0000-0002-9866-7051>) |
| Maintainer: | Konrad Rudolph <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.0.0.9000 |
| Built: | 2026-05-21 06:09:45 UTC |
| Source: | https://github.com/klmr/unpack |
The syntax c[...] = value unpacks the vector or list value
into as many separate variables, specified as ..., as there are
items.
c[...] = valuec[...] = value
... |
variable names to assign to. |
value |
vector or list to unpack. |
The number of names in ... must match length(value). If
there are too few or too many names, an error is raised.
An exception is made when the last name in ... is an index-less
subset expression, i.e. name[]. In that case, the first N-1
elements from value are assigned to the first N-1 variable
names, and the remaining elements are assigned to name.