Applying conditional functions on multiple columns of a dataframe, based on values of a variable
Advertisements I have a dataframe with a factor variable identifying my groups (here y), and multiple numerical variables (to simplify, here I only show two x and z): df = tribble( ~x, ~y, ~z, 1, "a", 5, 2, "b", 6, 3, "a", 7, 4, "b", 8, 5, "a", 9, 6, "b", 10 ) I want… Read More Applying conditional functions on multiple columns of a dataframe, based on values of a variable