title: dlply syntax with t.test
body: <p>I clearly still don't understand plyr syntax, as illustrated below. Can someone help me see what I'm missing?</p>
  
  <p>The following code works fine, as expected:</p>
  
  <pre><code># make a data frame to use dlply on 
  f &lt;- as.factor(c(rep("a", 3), rep("b", 3)))
  y &lt;- rnorm(6)
  df &lt;- data.frame(f=f, y=y)
  
  # split the data frame by the factor and perform t-tests
  l &lt;- dlply(df, .(f), function(d) t.test(y, mu=0))
  </code></pre>
  
  <p>However, the following causes an error</p>
  
  <pre><code>l_bad &lt;- dlply(df, .(f), t.test, .mu=0)
  Error in if (stderr &lt; 10 * .Machine$double.eps * abs(mx)) stop("data are essentially constant") : missing value where TRUE/FALSE needed
  </code></pre>
  
  <p>Which looks a bit as if R is trying to perform a t.test on the factor. Why would that be? Many thanks.</p>