mario icon indicating copy to clipboard operation
mario copied to clipboard

support rename_with()

Open pgbovine opened this issue 4 years ago • 0 comments

One straightforward way to support rename_with() is to simply render connections from all LHS columns to their corresponding RHS columns (assuming that all columns can possibly be renamed with the function and conditions). Then the frontend can manually diff the column names and render arrows only for those that have actually changed. Example:

# https://dplyr.tidyverse.org/reference/rename.html
library(dplyr)

iris <- as_tibble(iris) # so it prints a little nicer

# it would be nice to show which columns actually changed ... but i
# suppose the frontend can infer it if the backend JSON provides arrows
# from *all* LHS columns to their corresponding RHS columns, and the
# frontend can see which column names changed and only draw those
iris %>% rename_with(~ tolower(gsub(".", "_", .x, fixed = TRUE)))

pgbovine avatar Nov 04 '21 16:11 pgbovine