title: How to perform functions on a dataframe that is itself a result of a function (R)?
body: <p>I've built some code that performs simple arithmetic on three columns of numeric data of a dataframe (TypeChart) and binds it to the row names of the dataframe:</p>
  <pre><code>TypeCombo &lt;- function(type1, type2, type3) {
    data.frame(Type = row.names(TypeChart), Effectiveness = TypeChart[,type1] * TypeChart[,type2] * TypeChart[,type3])
  }
  </code></pre>
  <p>This produces a dataframe with a &quot;Type&quot; character vector (always fixed) and an &quot;Effectiveness&quot; numerical vector that varies depending on my inputs. I want to create a function that groups &quot;Type&quot; cells with the same &quot;Effectiveness&quot; value, but I'm not sure how to do this given the values change based on TypeCombo's inputs. It is also worth noting that the only values &quot;Effectiveness&quot; can take on are 0, 0.125, 0.25, 0.5, 1, 2, 4, and 8. How do I do this specific task, and more generally how does one go about building functions that act on variable lists/arrays/dataframes?</p>