title: Find top features by Id(Contains Multiple documents with same Id) from DTM
body: <p>I am using package tm.</p>
  
  <p>I have a dataframe with 2 columns, the first column is ID and the seocnd column contains text. The dataframe looks as follows.</p>
  
  <pre><code>Id       Text
  13456    Hi, Good morning
  13457    How are you?
  13456    May I know who I am speaking to?
  13456    Hi, Good evening
  </code></pre>
  
  <p>I have used the tm package and built dtm and extracted the top 5 words for each document and it looks like:</p>
  
  <pre><code>Id       Term1 Term2 Term3   Term4 Term5
  13456    Hi    Good  morning term4 term5
  13457    How   are   you     term4 term5
  13456    I     Know  may     who   to
  13456    Hi    Good  Evening term4 term5
  </code></pre>
  
  <p>But the required output is:</p>
  
  <pre><code>Id      Term1 Term2 Term3 Term4   Term5
  13456   Hi    Good  I     morning evening
  13457   How   are   you   term4   term5
  </code></pre>
  
  <p>I could not find any previous questions posted on this.
  Thanks in Advance.</p>