title: Multi-line strings with quotes in R
body: <p>I would like to select multiple lines of strings in R that contains internal quotation marks as a single object. However, I'd like to retain white spaces, line breaks and the double quotes <code>"</code> (and any single quotes <code>'</code>) inside the object. </p>
  
  <p>So far, all of the string functions I've tried (e.g., <code>cat</code>, <code>quote</code>, <code>paste</code> <code>print</code>) do not work. Using a function like <code>writeClipboard</code> doesn't work either unless I wrap the code in <code>"</code> (double quotation marks). </p>
  
  <ul>
  <li>However, when I do this, the <code>"</code> inside of the strings I want to combine interfere with the wrapping <code>"</code>s. </li>
  </ul>
  
  <p>Here's an example using writeClipboard (since this is my ultimate goal):</p>
  
  <p>This doesn't work:</p>
  
  <pre><code> writeClipboard(
     "
       x &lt;- 1 + 2
       y &lt;- "string" #I'm adding a random string surrounded by ""
       z &lt;- function(x,y) {
              paste(x,y)
            }
       z(x,y)
     "
   )
  </code></pre>
  
  <p>This <em>does</em> work (but I am forced to change all of my <code>"</code> to <code>'</code>): </p>
  
  <pre><code> writeClipboard(
     "
       x &lt;- 1 + 2
       y &lt;- 'string' #I'm adding a random string surrounded by ''
       z &lt;- function(x,y) {
              paste(x,y)
            }
       z(x,y)
     "
   )
  </code></pre>
  
  <p><strong>Is there a way to "save" multiple lines of strings contianing white spaces, line breaks, and mixed <code>'</code> and <code>"</code> characters into a single string?</strong> </p>
  
  <ul>
  <li>Again, I am primarily interested in doing so for <code>writeClipboard()</code>, but a more general answer would be appreciated as well!</li>
  </ul>
  
  <p>Thanks!</p>