lenses
lenses copied to clipboard
Reshaping/Retyping lenses
In the now closed #9 we proposed adding type conversion lenses.
In general we could have type conversion lenses
- [ ] df2list (with suitable arg checking on
set
) - [ ] list2df (with suitable arg checking on
view
) - [ ] vec2list (with suitable arg checking on
set
) - [ ] list2vec (with suitable arg checking on
view
) - [ ] vec2vec (perhaps using https://github.com/r-lib/vctrs)
we could also have reshaping lenses
- [ ] flatten_l: turn a nested list into a flat one
- [x] reshape_l: change the dimensions of an array subject to the condition that
prod(dim(x))
is preserved.