zeallot
Variable assignment with zeal! (or multiple, unpacking, and destructuring assignment in R)
zeallot provides destructuring assignment in R through the %<-% operator, allowing you to unpack lists, vectors, and other objects into multiple named variables in a single operation. This eliminates the need to manually extract values from list elements or function return values that contain multiple components.
The package is particularly useful when working with functions that return lists of multiple values, such as purrr::safely(), where you can immediately assign the result and error components to separate variables rather than dealing with nested list indexing. It supports nested unpacking for complex data structures, partial unpacking with collector syntax (..rest), and direct column extraction from data frames. The syntax makes code more concise and self-documenting by giving explicit names to each component at the point of assignment.
