Open cfhammill opened 6 years ago
@zsbuchwald noticed an opportunity to use lenses in of her analyses this morning! The task was renaming columns in a matrix:
df %>% setNames(c(names(.)[1], paste0("rel-", names(.)[-1])))
became the beautiful
df %>% over(names_l %.% indexes(-1), ~ paste0("rel-", .))
EDIT: for completeness this can be done with dplyr as well
dplyr
df %>% rename_at(vars(-1), funs(paste0("rel-", .))
@zsbuchwald noticed an opportunity to use lenses in of her analyses this morning! The task was renaming columns in a matrix:
became the beautiful
EDIT: for completeness this can be done with
dplyr
as well