title: How to create a funnel view in R
body: <p>I have a dataframe that has the following structure.</p>
  <pre><code>ProdID         Date                    class          price        set
  PD-10011       2021-05-01 10:12:16     Regular        1000         ZR
  PD-10712       2021-05-02 18:12:06     Premium        1000         ZR
  PD-10213       2021-05-02 16:02:59     Premium        1000         ZR
  PD-10814       2021-05-03 17:12:06     Premium        1000         RS
  PD-10315       2021-05-04 19:10:11     Other          1000         RR
  PD-10616       2021-05-04 13:18:14     Expired        1000         ZR
  PD-10617       2021-05-04 15:14:19     Regular        1000         ZR
  </code></pre>
  <p>I need to create a funnel view by utilizing the data frame considering the following conditions:</p>
  <p>May-21, the month should be auto-populating based on Date. If there are records of multiple months then it should be sequenced by month in descending month order. Here, <code>Total</code> is count of Total unique ProdID for that particular month. <code>Regular</code> is the count and sum of those ProdID having class as &quot;Regular&quot; and similar logic for the &quot;Premium&quot; row. The <code>miscellaneous</code> row is a count of ProdID having classes other than &quot;Regular&quot; and &quot;Premium&quot;. <code>RS (Premium)</code> is count and sum of those where the class is &quot;Premium&quot; along with set as &quot;RS&quot;.</p>
  <pre><code>May-21           Count of ProdID       Percentage Count       Sum of Price        Percentage Sum
  Total            7                     100.00%                7000                100.00%
  Regular          2                     28.57%                 2000                28.57%
  Premium          3                     42.85%                 3000                42.85%
  miscellaneous    2                     28.57%                 2000                28.57%
  RS (Premium)     1                     33.33%                 1000                33.33%  
  
           
  </code></pre>