wrapr

Using formulas with aliases to perform multi-column operations

人盡茶涼 提交于 2021-01-29 14:36:57
问题 This question is related to a previous one I asked, but trying to be more generic. I want to use formulas to perform operations on multiple "groups" of data (i.e. a_data1 , a_data2 , b_data1 , b_data2 , and then make operations using the *_data1 columns). Based on @akrun's answer to that question, I created the following function. It takes a one-sided formula and applies it to all the "groups of data": suppressPackageStartupMessages({ library(dplyr) library(tidyr) }) polymutate <- function(df