Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Our first user! #27

Open
cfhammill opened this issue Oct 15, 2018 · 0 comments
Open

Our first user! #27

cfhammill opened this issue Oct 15, 2018 · 0 comments

Comments

@cfhammill
Copy link
Owner

cfhammill commented Oct 15, 2018

@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

df %>%
  rename_at(vars(-1), funs(paste0("rel-", .))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant