title: Make function for concatenate in R
body: <p>I have a dataframe like:</p>
  
  <pre><code>Dis                           Area 
  NAGAR,SANGANER                NAGAR,PRATAP NAGAR,SANGANER
  NAGAR                         NAGAR,SODALA,BHANDARI
  JHUNJHUNUN,BARI               BARI
  </code></pre>
  
  <p>Splitting the data using the sep ","</p>
  
  <p>New Dataframe(df1) looks like the below:</p>
  
  <pre><code>Dis        Dis1        Area  Area1  Area2  Area3
  NAGAR      SANGANER    NAGAR PRATAP NAGAR SANGANER
  NAGAR                  NAGAR SODALA BHANDARI
  JHUNJHUNUN  BARI       BARI
  </code></pre>
  
  <p>Now, I want to concatenate Dis with Area and other respectively using sep "|". Similarly with Dis1
  dataframe will look like:(Desirable output)</p>
  
  <pre><code>Dis|Area         Dis1|Area        Dis|Area1           Dis1|Area1
  NAGAR|NAGAR      SANGANER|NAGAR   NAGAR|PRATAP NAGAR  SANGANER|PRATAP NAGAR
  NAGAR|NAGAR      |NAGAR           NAGAR|SODALA        |SODALA
  JHUNJHUNUN|BARI  BARI|BARI        JHUNJHUNUN|         BARI|
  </code></pre>
  
  <p>and so on....</p>
  
  <p>How to make a function for this.
  For all the columns post split, it automatically concatenate them with other columns.</p>