title: R - Count observations (strings) in a column and calculate as a percentage of overall observations
body: <p>Hi Have some data that looks like this:</p>
  <pre><code>ID   Item     Class  Value  Date
  1    Eggs     A      5      07/07/21
  2    Eggs     A      4.5    07/07/21
  3    Cereal   C      2      07/07/21
  4    Eggs     B      3.5    07/07/21
  5    Bread    B      2.5    07/07/21
  6    Juice    A      3      07/07/21
  7    Juice    C      1.5    07/07/21
  8    Eggs     C      2      07/07/21
  9    Bread    A      3      07/07/21
  10   Juice    A      3      07/07/21
  </code></pre>
  <p>This is just a sample, the actual data has around 8k rows (and there are 300+ dataframes). I want to create a new df that</p>
  <ol>
  <li>calculates the percentage of observations in the <code>Item</code> column (e.g. there are 10 items in the column, four of which are <code>Eggs</code>, thus the percentage of <code>Eggs</code> is 40)</li>
  <li>calculates the average <code>Value</code> of each <code>Item</code> group</li>
  </ol>
  <p>Ideally, the final data would look something like this:</p>
  <pre><code>Item    Percentage  Average_Value  Date
  Eggs    40          3.75           07/07/21
  Cereal  10          2              07/07/21
  Bread   20          2.75           07/07/21
  Juice   30          2.5            07/07/21
  </code></pre>
  <p>A couple of things to note - I want to do this to 300+ different csv's (where my data is stored) and create a single df with this new information. Each csv refers to a different date, so the final df would look something like the above, only with another four lines, but with different values and a different date. I know that I'll need to use a for loop for that, and maybe I should figure that part out later, but thought it was worth mentioning now. Finally, at some point, I might want to also calculate the average value of <code>Class</code>. Would I be better of making a separate df for this as I can't see how else I could do this?</p>