title: Send a text string containing double quotes to function
body: <p>I'm having a problem with using double quotes while formatting text strings being sent to functions in R.</p>
  
  <p>Consider an example function code:</p>
  
  <pre><code>foo &lt;- function( numarg = 5, textarg = "** Default text **" ){ 
      print (textarg)
      val &lt;- numarg^2 + numarg
      return(val) 
  }
  </code></pre>
  
  <p>when running with the following input:</p>
  
  <pre><code>foo( 4, "Learning R is fun!" )
  </code></pre>
  
  <p>The output is:</p>
  
  <pre><code>[1] "Learning R is fun!"
  [1] 20
  </code></pre>
  
  <p>But when I try (in various ways, as suggested <a href="https://stackoverflow.com/questions/11117321/solve-the-double-qoutes-within-double-quotes-issue-in-r">here</a>) to write "R" instead of R, I get the following outputs:</p>
  
  <pre><code>&gt; foo( 4, "Learning R is fun!" )
  [1] "Learning R is fun!"
  [1] 20
  &gt; foo( 4, "Learning "R" is fun!" )
  Error: unexpected symbol in "funfun( 4, "Learning "R"
  &gt; foo( 4, "Learning \"R\" is fun!" )
  [1] "Learning \"R\" is fun!"
  [1] 20
  &gt; foo( 4, 'Learning "R" is fun!' )
  [1] "Learning \"R\" is fun!"
  [1] 20
  </code></pre>
  
  <p>Using <code>as.character(...)</code> or <code>dQuote(...)</code> as suggested <a href="https://stackoverflow.com/questions/11179091/how-to-print-variables-inside-quotes-in-message">here</a> seems to break the function because of different number of arguments.</p>