title: How to combine rows with the same identifier R?
body: <p>I have been searching a lot but I can't seem to find an answer for what I'm looking for. The rows were originally melted together and then I spread them and now I have a data frame that look similar to this: 
  <a href="https://i.stack.imgur.com/MI0kO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MI0kO.png" alt="enter image description here"></a></p>
  
  <p>Here is the dput:</p>
  
  <pre><code>structure(list(ID = c(1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L), 
      `first name` = c("Jamie", NA, NA, NA, NA, "sandra", NA, NA, 
      NA, NA), `last name` = c(NA, "Johns", NA, NA, NA, NA, NA, 
      "chan", NA, NA), q1_ans = c(NA, NA, "yes", NA, NA, NA, "yes", 
      NA, NA, NA), q2_ans = c(NA, NA, NA, "no", NA, NA, NA, NA, 
      "yes", NA), q3_ans = c(NA, NA, NA, NA, "yes", NA, NA, NA, 
      NA, "no")), row.names = c(NA, -10L), class = c("tbl_df", 
  "tbl", "data.frame"), spec = structure(list(cols = list(ID = structure(list(), class = c("collector_integer", 
  "collector")), `first name` = structure(list(), class = c("collector_character", 
  "collector")), `last name` = structure(list(), class = c("collector_character", 
  "collector")), q1_ans = structure(list(), class = c("collector_character", 
  "collector")), q2_ans = structure(list(), class = c("collector_character", 
  "collector")), q3_ans = structure(list(), class = c("collector_character", 
  "collector"))), default = structure(list(), class = c("collector_guess", 
  "collector"))), class = "col_spec"))
  </code></pre>
  
  <p>The real dataframe I have has much more rows and a few more columns. I want to combine them so that everything for ID 1 is on one line, and ID 2 in one row, and so on. I've tried this but it hasn't gotten me anywhere</p>
  
  <pre><code>qr &lt;- qr %&gt;% 
    group_by(., ID) %&gt;%
    rowwise() %&gt;%
    summarise_all(funs(first(na.omit(.))))
  </code></pre>
  
  <p>I get the error:</p>
  
  <pre><code>Error in summarise_impl(.data, dots) : 
    Column `first name` must be length 1 (a summary value), not 0
  </code></pre>
  
  <p>I also tried dcast but that didn't help either. Thanks! </p>