title: How to run t-test on pairs of columns in dataframe in R?
body: <p>I have dataframe with 6 columns of numerical data. I want to run a t-test on pairs of columns in the form; the first + second column, third+fourth column, fifth + sixth column, until I have 3 t-test p-values which I can store in a new dataframe. </p>
  
  <p>I know I can get the columns with select() and I can extract the p-values with t.test(x,y)$p.values. But I can't figure out a good way of automating this in a for loop. </p>
  
  <p>I thought of doing something like this: </p>
  
  <pre><code>p-values &lt;- for (i in select(dataframe,-1) t.test(i,?)$p.value
  </code></pre>
  
  <p>As a start but not sure where to go from here.</p>