title: Error using t.test - not enough 'x' observations
body: <p>I have data where methylation has been measured. </p>
  
  <p>The data: <code>data.frame</code>, <code>900</code> observations <code>x 70</code> patients [30 ctrl, 40 case], all values are <code>numeric</code>, no <code>NA</code>s. </p>
  
  <p>I use the following code:</p>
  
  <pre><code>group &lt;- function(dFrame,toMatch)
  {
    matches &lt;- unique (grep(paste(toMatch,collapse="|"), 
                        colnames(dFrame), value=TRUE))
    return(dFrame[matches])
  }
  
  pValue &lt;- sapply(methySample, function(x) t.test( group (x,'case'),group (x,'ctrl'))$p.value)
  
  
  Error in t.test.default(group (x, "case"), group (x, "ctrl")) : 
    not enough 'x' observations 
  </code></pre>
  
  <p>I want pValue to be a vector with one entry for each observation-row. </p>
  
  <p>EDIT2: Here is an example - shortened but you should get the idea:</p>
  
  <pre><code>    case_01     case_02     case_03     ctrl_01     ctrl_02    ...
  1   0.876729    0.8760000   0.8835130   0.8999369   0.8642505
  2   0.8270763   0.7983686   0.8092107   0.8610273   0.8475543
  3   0.2591350   0.2829770   0.2735919   0.2556579   0.2735417
  4   0.8181337   0.8007408   0.7808821   0.8097073   0.7511147
  5   0.6217151   0.6061754   0.5850365   0.6151368   0.5680856
  6   0.6943685   0.7605200   0.6855676   0.6687362   0.7320926
  ...
  </code></pre>
  
  <p>Maybe someone here can help me to figure out what went wrong - maybe I am missing something obvious here. I have already seen other posts considering this error message but the answers were like 'do you have NAs in your data?' 'oh yea!' - this does not apply for my problem..
  Thank you!</p>