title: Combine multiple columns into vector by row with dplyr
body: <p>I am trying to combine multiple columns into a single cell for each row and then remove missing values.</p>
  
  <p>Sample data:</p>
  
  <pre><code>df &lt;- data.frame(a=c("a", "b", "c", "d"),
                   b=c(NA, "a", "b", "c"),
                   c=c("a", "b", "e", "g"))
  </code></pre>
  
  <p>Attempt:</p>
  
  <pre><code>df %&gt;% rowwise() %&gt;%
  mutate(collapse=as.character(paste(a,b,c, collapse=",")),
         collapse_nona=na.omit(collapse))
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code># A tibble: 4 x 5
    a     b     c     collapse                collapse_nona         
  * &lt;fct&gt; &lt;fct&gt; &lt;fct&gt; &lt;chr&gt;                   &lt;chr&gt;                 
  1 a     NA    a     a NA a,b a b,c b e,d c… a NA a,b a b,c b e,d …
  2 b     a     b     a NA a,b a b,c b e,d c… a NA a,b a b,c b e,d …
  3 c     b     e     a NA a,b a b,c b e,d c… a NA a,b a b,c b e,d …
  4 d     c     g     a NA a,b a b,c b e,d c… a NA a,b a b,c b e,d …
  </code></pre>
  
  <p>1) I am not successfully creating cells with values for each row (the whole column appears in collapse). </p>
  
  <p>2) Cells in the collapse column do not behave like a vector.</p>
  
  <p>Desired output</p>
  
  <pre><code>  a     b     c     collapse                collapse_nona         
  * &lt;fct&gt; &lt;fct&gt; &lt;fct&gt; &lt;chr&gt;                   &lt;chr&gt;                 
  1 a     NA    a     a NA a                  a a
  2 b     a     b     b a b                   b a b
  3 c     b     e     c b e                   c b e
  4 d     c     g     d c g                   d c g
  </code></pre>
  
  <p>Thank you</p>