title: split string without loss of characters
body: <p>I wish to split strings at a certain character while retaining that character in the second resulting string.  I can achieve almost all of the desired operation, except that I lose the characters I specify in <code>strsplit</code>, which I guess is called the delimiter.</p>
  
  <p>Is there a way to request that <code>strsplit</code> retain the delimiter?  Or must I use a regular expression of some kind?  Thank you for any advice.  This seems like a very basic question.  Sorry if it is a duplicate.  I prefer to use base R.</p>
  
  <p>Here is an example showing what I have so far:</p>
  
  <pre><code>my.table &lt;- read.table(text = '
                                                              model npar     AICc 
   AA(~region+state+county+city)BB(~region+state+county+city)CC(~1)   17 11111.11
           AA(~region+state+county)BB(~region+state+county)CC(~123)   14 22222.22
                          AA(~region+state)BB(~region+state)CC(~33)   13 33333.33
                                    AA(~region)BB(~region)CC(~4321)    6 44444.44
  ', header = TRUE, stringsAsFactors = FALSE)
  
  desired.result &lt;- read.table(text = '
                                                        model        CC npar     AICc
   AA(~region+state+county+city)BB(~region+state+county+city)    CC(~1)   17 11111.11
             AA(~region+state+county)BB(~region+state+county)  CC(~123)   14 22222.22
                           AA(~region+state)BB(~region+state)   CC(~33)   13 33333.33
                                       AA(~region)BB(~region) CC(~4321)    6 44444.44
  ', header = TRUE, stringsAsFactors = FALSE)
  
  split.model  &lt;- strsplit(my.table$model, 'CC\\(')
  
  split.models &lt;- matrix(unlist(split.model), ncol=2, byrow=TRUE, dimnames = list(NULL, c("model", "CC")))
  
  desires.result2 &lt;- data.frame(split.models, my.table[,2:ncol(my.table)])
  desires.result2
  
  #                                                       model     CC npar     AICc
  # 1 AA(~region+state+county+city)BB(~region+state+county+city)    ~1)   17 11111.11
  # 2           AA(~region+state+county)BB(~region+state+county)  ~123)   14 22222.22
  # 3                         AA(~region+state)BB(~region+state)   ~33)   13 33333.33
  # 4                                     AA(~region)BB(~region) ~4321)    6 44444.44
  </code></pre>