title: doing t.test for columns for each row in data set
body: <p>I have a set of data <code>x</code> which consists of 12 columns and 167 rows. The first column is compound Id for each row. I want to run a <code>t.test</code> for 3 column as one group and the other 3 groups as the second group, separately for each row. My code is as below but it does not work.</p>
  
  <pre><code>for (i in 1:nrow(x)) {
   function(i)c(compound=i,
      t.test(x[2:4],x[8:10],
        x[x$compound==i, ],
        alternative='two.sided',conf.level=0.95)
      )
  }
  print(c(compound=i,t.test(x[2:4],x[8:10],x[x$compound==i,],
      alternative='two.sided',conf.level=0.95)))
  </code></pre>
  
  <p>My intention was doing a <code>t.test</code> for each metabolite (compound) between AC groups and SC groups, these are two group of cells.</p>
  
  <pre><code>compound    AC-1     AC-2     AC-3     AM-1      AM-2      AM-3      SC-1     SC-2     SC-3     SM-1      SM-2      SM-3
  alanine     27612820 22338050 15359640 19741350  18726880  18510800  10914980 12071660 16036180 16890860  16066960  16364300
  arginine    7067206  7172234  5933320  136272600 131596800 134717600 6102838  7186256  6770344  140127100 155341300 151748000
  asparagine  3151398  2141378  1240904  11522180  8907711   9842342   1677299  2265826  2942991  11690360  12552660  12102620                        
  </code></pre>