title: Developing Functions to Make New Dataframes in R
body: <p>I am trying to develop a function that will take data, see if it matches a value in a category (e.g., 'Accident', and if so, develop a new dataframe using the following code.</p>
  
  <pre><code>cat.df &lt;- function(i) {
     sdb.i &lt;- sdb %&gt;%
     filter(Category == i) %&gt;%
     group_by(Year) %&gt;%
     summarise(count = n()}
  </code></pre>
  
  <p>The name of the dataframe should be sdb.i, where i is the name of the category (e.g., 'Accident'). Unfortunately, I cannot get it to work. I'm notoriously bad with functions and would love some help.</p>