Closed ttrodrigz closed 4 months ago
Regex is more difficult, you can only use a compound pipe. The others are easier, you can directly use the selector function:
library(fastverse)
pivot(iris, values = is.numeric)
iris %>% pivot(values = grep("\\.", names(.)))
fsummarise(
iris,
across(
.cols = is.numeric,
.fns = fmean
)
)
The latter is redundant though. the collapse way would be
iris |> num_vars() |> fmean(drop = FALSE)
Understood, thank you! The collapse version of the summarise operation is slick.
This is more of a question, not an issue. I am wondering if there is a collapse equivalent to a tidyselect style of selecting variables within functions such as
pivot()
orfsummarise(..., across())
.Here are some things, for example, I do on a very regular basis using dplyr or tidyr:
Is there a way within collapse for variable selecting by a logical condition or via regex? I know that the
gvr()
function allows for selecting of columns by regex, but I don't know if that can be paired with other functions?Thanks for all the great work, I love the collapse packge.