Faster way to achieve filtering for all possible combinations
问题 Consider I have a data frame like this, set.seed(1) q<-100 df <- data.frame(Var1 = round(runif(q,1,50)), Var2 = round(runif(q,1,50)), Var3 = round(runif(q,1,50)), Var4 = round(runif(q,1,50))) attach(df) As you realized, q is standing for setting the length of the each columns in the dataframe. I want to make a filtering of all possible combinations of the columns. It can be anything. Let's say I am seeking for if the devision of the sums of the first two columns and the sums of the last two