standard error binary variable R
<p>How can I calculate the standard error for a binary variable using R?
I have a group of participants performing a task across several conditions. The output might be 0 (incorrect) or 1 (correct). I have calculated the mean proportion of correct answers and standard error (SE) in the next way:</p>

<pre><code>mean&lt;-tapply(dataRsp$Accuracy, dataRsp$Condition, FUN=mean)

SE&lt;- with(dataRsp, tapply(Accuracy, Condition, sd)/sqrt(summary(dataRsp$Condition)) )
</code></pre>

<p>But the SE are extremelly tight that they can hardly be correct. Might someone give me some ideas?I found that the next might be the solution,</p>

<pre><code>sqrt(p.est*(1-p.est)/n)
</code></pre>

<p>... but I don't know how to implement it to R.</p>