title: summarize categorical data based on grouping
body: <p>I have a data frame in the following form</p>
  
  <pre><code>Id &lt;- c(101,102,103,101,103,103,102,101,103,102)
  Service &lt;- c('A','B','A','C','A','A','B','C','A','B')
  Type &lt;- c('C','I','C','I','C','C','C','I','I','C')
  Channel &lt;- c('ATM1','ATM2','ATM1','Teller','Teller','ATM2','ATM1','ATM1','ATM2','Teller')
  amount &lt;- c(11,34,56,37,65,83,26,94,34,55)
  
  df &lt;- data.frame(Id,Service,Channel,Type,amount)
  </code></pre>
  
  <p>df in tabular formate</p>
  
  <pre><code>Id Service Channel Type amount
  101       A    ATM1    C     11
  102       B    ATM2    I     34
  103       A    ATM1    C     56
  101       C  Teller    I     37
  103       A  Teller    C     65
  103       A    ATM2    C     83
  102       B    ATM1    C     26
  101       C    ATM1    I     94
  103       A    ATM2    I     34
  102       B  Teller    C     55
  </code></pre>
  
  <p>I am able to summarize my data using <code>amount</code> column as <code>df %&gt;% group_by(Id) %&gt;% summarise(total = sum(amount)) %&gt;% as.data.frame</code></p>
  
  <pre><code> Id total
  101   142
  102   115
  103   238
  </code></pre>
  
  <p>How can I summarize data in a similar way using categorical columns (Service/Type/Channel) and <code>group_by(Id)</code>? I know we can use <code>table()</code> here, but I am trying to create a data frame, which I can use it for further analysis, such as clustering.</p>