title: Dplyr summarise multiple columns based on condition
body: <p>I have a datasaet like this:</p>
  
  <pre><code>df.in &lt;-structure(list(id = c(1, 1, 2, 3), x1 = c(0, 1, NA, 0), x2 = c("Lorem ipsum dolor sit amet", 
                                                                      "dolore eu fugiat nulla pariatur", "Sed ut perspiciatis unde omnis", 
                                                                      "Nemo enim ipsam voluptatem"), x3 = c("Donec ullamcorper elit quis risus", 
                                                                                                            "Donec ullamcorper elit quis risus", "Curabitur euismod", "Mauris felis orci"
                                                                      )), row.names = c(NA, -4L), class = c("tbl_df", "tbl", "data.frame"
                                                                      ))
  
  &gt; df.in
  # A tibble: 4 x 4
       id    x1 x2                              x3                               
    &lt;dbl&gt; &lt;dbl&gt; &lt;chr&gt;                           &lt;chr&gt;                            
  1     1     0 Lorem ipsum dolor sit amet      Donec ullamcorper elit quis risus
  2     1     1 dolore eu fugiat nulla pariatur Donec ullamcorper elit quis risus
  3     2    NA Sed ut perspiciatis unde omnis  Curabitur euismod                
  4     3     0 Nemo enim ipsam voluptatem      Mauris felis orci 
  </code></pre>
  
  <p><br></p>
  
  <p>I'm trying to <code>dplyr::group_by()</code> to obtain this:</p>
  
  <pre><code>df.out &lt;- structure(list(id = c(1, 2, 3), x1 = c(1, NA, 0), x2 = c("dolore eu fugiat nulla pariatur", 
                                                                     "Sed ut perspiciatis unde omnis", "Nemo enim ipsam voluptatem"
  ), x3 = c("Donec ullamcorper elit quis risus", "Curabitur euismod", 
            "Mauris felis orci")), row.names = c(NA, -3L), class = c("tbl_df", 
                                                                     "tbl", "data.frame"))
  
  &gt; df.out
  # A tibble: 3 x 4
       id    x1 x2                              x3                               
    &lt;dbl&gt; &lt;dbl&gt; &lt;chr&gt;                           &lt;chr&gt;                            
  1     1     1 dolore eu fugiat nulla pariatur Donec ullamcorper elit quis risus
  2     2    NA Sed ut perspiciatis unde omnis  Curabitur euismod                
  3     3     0 Nemo enim ipsam voluptatem      Mauris felis orci  
  </code></pre>
  
  <p><br></p>
  
  <p>I can do:</p>
  
  <pre><code>df.in %&gt;%
    group_by(id) %&gt;%
    summarise(x1 = max(x1))
  </code></pre>
  
  <p><br></p>
  
  <p>However, how do I:</p>
  
  <ol>
  <li>Summarize <code>x2</code>, <code>x3</code> to keep the value where <code>max(x1)</code> occurs?</li>
  <li>I have several <code>x</code>'s all needing the same logic. Is there a way to do a <code>summarize_all</code>?</li>
  </ol>