title: R concatenate several cells into one without getting NA
body: <p>I have already been browsing through some of the anwsers on stackflow, but I don't understand much (yet) of the many sophisticated solutions, I just started on R two weeks ago. This is a sample data.frame:</p>
  
  <pre><code>#rm(list = ls()) 
  A= c(1,2,3)
  B= c("Africa", "Asia", NA)
  C= c("Tiger", "Bear", "Dog")
  
  df =  data.frame(A, B, C, stringsAsFactors=FALSE)
  
  
    A      B     C             
  1 1 Africa Tiger    
  2 2   Asia  Bear    
  3 3   &lt;NA&gt;   Dog    
  </code></pre>
  
  <p>I would like to merge my columns so that it looks like this:</p>
  
  <pre><code>A= c(1,2,3)
  B= c("Africa", "Asia", NA)
  C= c("Tiger", "Bear", "Dog")
  D= c("1AfricaTiger", "2AsiaBear", "3Dog")
  Howitshouldlook = data.frame(A, B, C, D, stringsAsFactors = FALSE)
  
  
  
    A      B     C            D
    1 Africa Tiger 1AfricaTiger
    2   Asia  Bear    2AsiaBear
    3   &lt;NA&gt;   Dog         3Dog
  </code></pre>
  
  <p>What I tried was:</p>
  
  <pre><code>df$D &lt;- with(df, paste(df$A, df$B, df$C))
  </code></pre>
  
  <p>The result was unfortunately</p>
  
  <pre><code>  A      B     C              D
    1 Africa Tiger 1 Africa Tiger
    2   Asia  Bear    2 Asia Bear
    3   &lt;NA&gt;   Dog       3 NA Dog
  </code></pre>
  
  <p>I already read that the NA is often a problem, but I dont seem to find an easy solution to this. Can someone either link me to a beginners' solution or either explain to me how I can merge cells without the "NA" as well as without the blanks? </p>
  
  <p>Many thanks! 
  Steffi </p>