modifyList() and purrr::modify_in() are not enough.
We need better utilities to rename, reorder, remove, apply etc
We need also to do a bit better than pluck accessors, by being able to access several items.
We can use tidy selection, but it returns a number, so we need to map these numbers to nodes or leafs.
If we want a pluck like notation we might combine with |, and use list() rather than c(), e.g. list(1, "a" | has_depth(3), "foo")
note that pluck might support tidy selection soonish.
We could have a ls_prune() function that would look and work like pluck except that it would return a subset of the list. We would use v like "vertical" to go deeper into the indices, and h like "horizontal" to select different elements at a given depth.
modifyList() and purrr::modify_in() are not enough.
We need better utilities to rename, reorder, remove, apply etc
We need also to do a bit better than pluck accessors, by being able to access several items.
We can use tidy selection, but it returns a number, so we need to map these numbers to nodes or leafs.
If we want a pluck like notation we might combine with
|
, and uselist()
rather thanc()
, e.g.list(1, "a" | has_depth(3), "foo")
note that pluck might support tidy selection soonish.
We could have a
ls_prune()
function that would look and work like pluck except that it would return a subset of the list. We would usev
like "vertical" to go deeper into the indices, andh
like "horizontal" to select different elements at a given depth.any_of()
andall_of()
would be put to good use