title: split characters into two variables in data frame
body: <p>Let's say I have a vector of variables like this:</p>
  
  <pre><code>&gt;variable
  [1] "A1" "A1" "A1" "A1" "A2" "A2" "A2" "A2" "B1" "B1" "B1" "B1"
  </code></pre>
  
  <p>and I want to covert this into into a data frame like this:</p>
  
  <pre><code>  treatment time
  1         A    1
  2         A    1
  3         A    1
  4         A    1
  5         A    2
  6         A    2
  7         A    2
  8         A    2
  9         B    1
  10        B    1
  11        B    1
  12        B    1
  </code></pre>
  
  <p>To that end, I used reshape2's colsplit function. It rquires a pattern to split the string, but I quickly realize there is no obvious pattern to split the two characters without any space.
  I tried "" and got the following results:</p>
  
  <pre><code>&gt; colsplit(trialm$variable,"",names=c("treatment","time"))
     treatment time
  1         NA   A1
  2         NA   A1
  3         NA   A1
  4         NA   A1
  5         NA   A2
  6         NA   A2
  7         NA   A2
  8         NA   A2
  9         NA   B1
  10        NA   B1
  11        NA   B1
  12        NA   B1
  </code></pre>
  
  <p>I also tried a lookbehind or lookahead regular expression :</p>
  
  <pre><code>&gt;colsplit(trialm$variable,"(?&lt;=\\w)",names=c("treatment","time"))
  Error in gregexpr("(?&lt;=\\w)", c("A1", "A1", "A1", "A1", "A2", "A2", "A2",  : 
    invalid regular expression '(?&lt;=\w)', reason 'Invalid regexp'
  </code></pre>
  
  <p>but it gave me the above error. How can I solve this problem?</p>