title: t.test error using ddply; count matches yet says not many observations
body: <p>DON'T MARK DUPLICATE IF YOU CAN'T SPECIFICALLY ANSWER THIS QUESTION</p>
  
  <p>and I am not using lapply nor does the question match with <a href="https://stackoverflow.com/questions/15656614/error-using-t-test-in-r-not-enough-y-observations">this</a></p>
  
  <pre><code>size income.gap count1 count2
   1    1000000   656   656  
   2    1000000   1443  1443  
   3    1000000   1232  1232  
   4    1000000   1036  1036  
   5    1000000   540   540  
   6    1000000   227   227  
   7    1000000    94    94  
   8    1000000    38    38  
   9    1000000    22    22  
  10    1000000     4     4  
  
  
  
  gap.data.conf &lt;- ddply(data, ~ size, summarize, 
                     gap = mean(income[gender == "Male"], na.rm = TRUE) - mean(income[gender == "Female"], na.rm = TRUE),
                     upper = -t.test(income ~ gender)$conf.int[1],
                     lower = -t.test(income ~ gender)$conf.int[2])
  </code></pre>
  
  <p>ERROR:</p>
  
  <pre><code> Error in t.test.default(x = c(35000L, 24000L, 24000L), y = 26000L) :
  not enough 'y' observations
  </code></pre>
  
  <p>Can anyone guide me, why there are not enough y observations, although the count is equal as shown in the table above?</p>