title: Split string in R by \ character
body: <p>I have column <code>sr$classf</code> in <code>sr</code> dataframe with string like hierarchy <code>servicegroup\service\servicerequest\</code>. I want to split string with <code>strsplit()</code> by <code>\</code> character and put different parts of splitted string in additional columns.
  For example I create <code>sr.c7$service</code> column ans put first part before <code>\</code></p>
  
  <pre><code> sr$service &lt;- as.character(lapply(strsplit(as.character(sr$classf), split="\"), "[", 1))
  </code></pre>
  
  <p>But R comment out all code following <code>split="\"</code>. What should I do to use <code>\</code> as a split parameter?</p>
  
  <p><strong>Solution:</strong></p>
  
  <pre><code> sr$service &lt;- as.character(lapply(strsplit(as.character(sr$classf), split="\\\\"), "[", 1))
  </code></pre>