Description
dplyr::across
has a .names
arg that similarly routes to glue
. Maybe we should match to remove the X ways to do things, and also get closer to actual across
support.
Musing: One annoyance with the dplyr::across
interface is that, if you have multiple functions and you want heterogeneous naming schemes, it doesn't naturally support it; you have to use the same glue expression for everything, and it also adds numbers as the names for functions/formulas "without" a name, so it's not obviously convenient to produce an output column with the same name as an input column + another output column with auxiliary info and a suffix. [A solution here is to do .names = {paste0(.col, c("", "_suffix"))
.] We currently have a non-glue .new_col_names
arg that would support that, but it's also less of an issue since we don't allow overwriting columns anyway, and don't allow multiple functions at once. Nevertheless, we could think about supporting .names
being a vector of glue expressions in addition to just a single glue expression. If we don't move to .names
, we might think about supporting vectors of glue expressions in .prefix
and .suffix
.