title: Error using t.test() in R - not enough 'y' observations
body: <p>I got this error for my code</p>
  
  <pre><code>Error in t.test.default(dat$Value, x[[i]][[2]]) : 
    not enough 'y' observations
  </code></pre>
  
  <p>I think the reason I got this error is because I'm doing a t.test for data that only has one value (so there wouldnt be a mean or an sd) vs data that has 20 values..is there a way I can get around this.. is there a way I can ignore the data that doesn't have enough y observations??? like an if loop might work...pls help</p>
  
  <p>So my code that does the t.test is </p>
  
  <pre><code>t&lt;- lapply(1:length(x), function(i) t.test(dat$Value,x[[i]][[2]]))
  </code></pre>
  
  <p>where x is data in the form of cuts similar to</p>
  
  <pre><code>cut: [3:8)
          Number   Value
  3       15        8
  4       16        7
  5       17        6
  6       19        2.3
  this data goes on 
  cut:[9:14)
        Number   Value
  7     21        15
  cut:[13:18) etc
        Number    Value
  8     22        49
  9     23        15
  10    24        13
  </code></pre>
  
  <p>How can I ignore 'cuts' that have only  1 value in them like the example above where in 'cut[9:14)' theres only one value....</p>