Create a lens into a named collection. On set names of the input are not changed. This generalizes dplyr::select to arbitrary named collections and allows updating.
select_l(...)
... | An expression to be interpreted by tidyselect::vars_select which is the same interpreter as dplyr::select |
---|
lets <- setNames(seq_along(LETTERS), LETTERS) set(lets, select_l(G:F, A, B), 1:4) # A and B are 3,4 for a quick check#> A B C D E F G H I J K L M N O P Q R S T U V W X Y Z #> 3 4 3 4 5 2 1 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26