Re: [R] dplyr: summarise across using variable names and a condition

2021-03-26 Thread Rui Barradas
Hello, Here is a way of doing what the question asks for. There might be others, simpler, but this one works. have %>% summarise(across( .cols = !contains("ptno"), .fns = list(mean = mean, std = sd), .names = "{col}_{fn}" )) %>% select( -matches("^gender_.*_std$"), -m

[R] dplyr: summarise across using variable names and a condition

2021-03-26 Thread Paul Miller via R-help
Hello All, Would like to be able to summarize across in dplyr using variable names and a condition. Below is an example "have" data set followed by an example "need" data set. After that, I've got a vector of numeric variable names. After that, I've got the very humble beginnings of a dplyr-bas