title: dplyr's summarise returns same p-value for each participant
body: <p>I am trying to use <code>dplyr</code>'s <code>summarise</code> function to loop through a data frame and get a p-value for each participant in the data frame.</p>
  
  <p>However, the following code seems to return the same p-value for participants 2 and 3, despite the fact that they should <em>not</em> be the same.</p>
  
  <p>(Not only are they the same p-value, but the value that is returned isn't even the correct p-value for either of the participants.)</p>
  
  <p>How can I fix this? What am I doing wrong?</p>
  
  <pre class="lang-r prettyprint-override"><code>PARTICIPANT &lt;- c(rep(1,12),
                   rep(2,12),
                   rep(3,12)
                   )
  ACCURACY &lt;- c(rep(1,12),
                c(1,1,1,0,0,0,0,0,0,0,0,0),
                c(1,1,1,0,0,0,0,0,0,1,1,1)
                )
  data &lt;- as.data.frame(cbind(PARTICIPANT,ACCURACY))
  library(dplyr)
  data &lt;- data %&gt;%
      group_by(PARTICIPANT) %&gt;%
      summarise(PVALUE = ifelse(is(try(t.test(ACCURACY, mu = 0.5, alternative = "greater"), silent = T), "try-error"), 0, t.test(ACCURACY, mu = 0.5, alternative = "greater")$p.value),
                MEANACCURACY = mean(ACCURACY)
                )
  </code></pre>