title: How optimizar this code in R (split string to columns)
body: <p>I have this R code that works:</p>
  <pre><code>df &lt;- data.frame(C1=c('[AU 1] string 1; [AU 2] string 2; [AU 3] string 3.1; string 3.2; [AU 4] string 
  4.1; string 4.2; [AU 5] string 5','[AU 1; AU 2] string 1','[AU 1] string 1; [AU 2] string 2'), 
  UT=c(&quot;A1&quot;,&quot;A2&quot;,&quot;A3&quot;))
  
  s &lt;-strsplit(df$C1, split = &quot;(; (?=\\[))&quot;,perl=TRUE)
  
  df1&lt;-data.frame(
  UT= rep(df$UT, sapply(s, length)),
  AU=gsub('] .*', ']', unlist(s)),
  C1=gsub('.*\\]', '', unlist(s)))
  
  s1 &lt;-strsplit(df1$C1, split = &quot;; &quot;,perl=TRUE)
  
  df2&lt;-data.frame(
  UT= rep(df1$UT, sapply(s1, length)),
  AU= rep(df1$AU, sapply(s1, length)),
  C1=unlist(s1))
  </code></pre>
  <p><strong>How to make this code more efficient, any ideas?</strong></p>
  <p>obs: The base has more than 1 million rows.</p>