title: Paste/Collapse in R
body: <p>I'm confused by paste, and thought it was just simple concatenating.</p>
  
  <pre><code>whales &lt;- c("C","D","C","D","D")
  
  quails &lt;- c("D","D","D","D","D")
  
  results &lt;-paste(whales, quails, collapse = '')
  </code></pre>
  
  <p>Why would this return "C DD DC DD DD D" instead of CD DD CD DD DD?</p>
  
  <p>Moreover, why would</p>
  
  <pre><code>results &lt;-paste(whales[1], quails[1], collapse = '')
  </code></pre>
  
  <p>return</p>
  
  <p>"C D" ?</p>
  
  <p>with a space?</p>
  
  <p>Thanks,
  D</p>
  
  <p>EDIT</p>
  
  <p>OK, I see that</p>
  
  <pre><code>results &lt;-paste(whales, quails, collapse = NULL, sep='')
  </code></pre>
  
  <p>will get me what I want, but an explanation of why the previous code didn't work? And also thank you to the answerers.</p>