You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One common thing that I want to do in the dplyr workflow is take a set of variables, apply some function to them, and create a new set of variables. across makes this really easy, but it almost always requires me updating the names in a second step with rename_with. I'm wondering if a function would be passed to .names that accepts the vector of column names and returns the resulting columns names.
Ahh, I think I figured it out. Since it's a call to glue(), you can pass a function within the {} like .names = "{gsub("emp_", "share_", .col)}. Would y'all recommend a PR with an example of this in the colwise vignette?
One common thing that I want to do in the
dplyr
workflow is take a set of variables, apply some function to them, and create a new set of variables.across
makes this really easy, but it almost always requires me updating the names in a second step withrename_with
. I'm wondering if a function would be passed to.names
that accepts the vector of column names and returns the resulting columns names.For example, I would want:
to become:
Admittedly, I haven't thought of how that would play with other features of the function (e.g. multiple functions). Thanks for the consideration!
The text was updated successfully, but these errors were encountered: