I'm currently in the process of designing what is essentially a maximization algorithm in R. What I'm trying to figure out is how to apply a "for each" and "subset by" (more accurately, "count/sum if") for an undefined number of variables (each in it's own column).I'm currently in the process of designing what