title: Using a t.test inside dplyr summarise after grouping
body: <pre><code>library(dplyr)
  library(ggplot2)
  library(magrittr)
  
  diamonds %&gt;% 
    group_by(cut) %&gt;% 
    summarise(price_avg = t.test(
      . %&gt;% filter(color == "E") %$% price,
      . %&gt;% filter(color == "I") %$% price )$p.value)
  </code></pre>
  
  <p>I'm trying to get the result of a t.test to apply by group. In this example finding if there is a significant difference in price of colour when looking at the same cut. The result I get is:</p>
  
  <pre><code>Error in summarise_impl(.data, dots) : 
  Evaluation error: is.atomic(x) is not TRUE.
  </code></pre>