title: Apply tidyr::separate over multiple columns
body: <p>I would like to iterate over columns in a dataframe and split them into the based on a separator. I am using <code>tidyr::separate</code>, which works when I do one column at a time. </p>
  
  <p>For example:</p>
  
  <pre><code>df&lt;- data.frame(a = c("5312,2020,1212"), b = c("345,982,284"))
  
  df &lt;- separate(data = df, col = "a", 
                           into = paste("a", c("col1", "col2", "col3"), 
                                        sep = "_"), sep = ",")
  </code></pre>
  
  <p>Returns:</p>
  
  <pre><code>  a_col1 a_col2 a_col3           b
  1   5312   2020   1212 345,982,284
  </code></pre>
  
  <p>When I try to execute the same operation over each column of <code>df</code> R returns an error</p>
  
  <p>For example I used this for loop:</p>
  
  <pre><code>for(col in names(df)){
      df &lt;- separate(data = df, col = col, 
  into = paste(col, c("col1", "col2", "col3), 
  sep = "_"), sep = ",")
      }
  </code></pre>
  
  <p>I was expecting to get the following output:</p>
  
  <pre><code>  a_col1 a_col2 a_col3 b_col1 b_col2 b_col3
  1   5312   2020   1212    345    982    284
  </code></pre>
  
  <p>However R returns this error:</p>
  
  <pre><code>Error in if (!after) c(values, x) else if (after &gt;= lengx) c(x, values) else c(x[1L:after],  : 
    argument is of length zero
  </code></pre>
  
  <p>Is there another way to apply <code>tidyr::separate</code> over multiple columns in a data frame?</p>