title: Automated data frame summaries with mixed data types
body: <p>I am trying to automatically create a new data frame that, given an existing data frame, contains either the median of a numerical variable or the most common category for a factor.  So:</p>
  
  <pre><code>Number Factor  
  3      A
  2      A
  5      B
  </code></pre>
  
  <p>Should turn into</p>
  
  <pre><code>Number Factor  
  3      A
  </code></pre>
  
  <p>I can calculate it for each variable individually. For purely numerical variables I could even use the colMeans command. For purely factor variables I would use which.max(). But I have not been able to combine the two into a scalable and flexibe solution</p>