title: r: escape single quote in a string
body: <p>I have a string like <code>a &lt;- "abc'def"</code> and I need to paste this into a longer sql string:</p>
  
  <pre><code> s &lt;- paste0("select * from x where xx ='", a, "'")
  </code></pre>
  
  <p>But the <code>single quote</code> in the middle makes it fail, I cannot manually replace <code>' with \'</code> but need to use a function. </p>