-
Notifications
You must be signed in to change notification settings - Fork 35
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Regex support in get_vars() trivializes dealing with optional columns, but there's no equivalent to renaming afaik other than strings of if blocks. An option to ignore missing columns while renaming would mimic tidyselect's any_of and replace a great deal of boilerplate and repeated code.
eg:
library(tidyverse)
library(collapse)
sample<-data.frame(
foo="foo",
bar="bar",
foobar="foobar"
)
sample<-sample |> rename(any_of(c(both="foobar",both="foo_bar")))
##contrast with
if("foobar" %chin% names(sample)){
sample<-sample |> frename(both="foobar")
}
if("foo_bar" %chin% names(sample)){
sample<-sample |> frename(both="foo_bar")
}Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request