title: Text-to-column equivalent in R, splitting dataframe on character
body: <p>I'd like to know how to split columns in a similar way that excel does in the "text-to-column" feature. There are many tutorials on stackexchange about how to split columns by a character, but they don't address 3 things I need: </p>
  
  <p>1). work with a column, where only some of the rows have the character
  2). work with a dataframe that has many columns
  3). treat columns as characters/factors</p>
  
  <p>For instance, I have a dataframe</p>
  
  <pre><code>    df &lt;- data.frame(V1 = c("01, 02", "04", "05, 06", "07, 08", "09", "10"),
           V2 = c("11, 12", "14", "13, 14", 11, 14", "13", "15")
  </code></pre>
  
  <p>If i were to use text-to-columns out of V1 in excel, I would end up with 3 columns split on the comma. A second column would be created for only those cells which had a comma in the them. There would be blank cells for rows which had no column. I would also have the option of treating the new column as a number or text. In this case, I need the leading zero, so it should be treated as text.</p>
  
  <p>It would look something like this</p>
  
  <pre><code>           V1    V2   V3      
      Row 1   01   02   11,12
      Row 2   04   NA   14
  </code></pre>
  
  <p>How would I do something similar in R, keeping in  mind that the dataset I have has many columns, so its not practical to rename every single column in the code. </p>
  
  <p>I hope this was clear. Thank you for the help!</p>