title: How to safely escape quotes in R to submit text to SQL?
body: <p>I have some strings in <code>R</code> which should be written into a <code>MySQL</code> table using <code>RODBC</code>. 
  The problem is that I do not know <strong>how to handle quotes within the strings to get no MySQL errors but to also not mess up the text?</strong></p>
  
  <p>I am sure the solution is kind of simple but at the moment I am kind of stuck in my own thinking - I do not get out of the box ... escaping not escaping escaping twice with 2 backslashes or better 4 (or 8, just to be on the save side)</p>
  
  <p><strong>example:</strong></p>
  
  <pre><code>require(RODBC)
  con     &lt;- odbcConnect("MyMySQLDatabase")
  
  string  &lt;- "What's up?"
  query   &lt;- "INSERT INTO table (textcolumn) VALUES"
  
  value   &lt;- paste0( "('", string, "')" )
  sql     &lt;- paste( query, value, ";")
  
  res     &lt;- sqlQuery(con, sql)
  </code></pre>
  
  <p>(How to handle text that I read in from files with possible single and double quotes?)</p>