title: For loop using a t-stat function to create a list
body: <p>I am using the following function to calculate the t-stat for data in data frame (x):</p>
  
  <pre><code>    wilcox.test.all.genes&lt;-function(x,s1,s2) {
       x1&lt;-x[s1]
       x2&lt;-x[s2]
       x1&lt;-as.numeric(x1)
       x2&lt;-as.numeric(x2)
       wilcox.out&lt;-wilcox.test(x1,x2,exact=F,alternative="two.sided",correct=T)
       out&lt;-as.numeric(wilcox.out$statistic)
       return(out)
      }
  </code></pre>
  
  <p>I need to write a for loop that will iterate a specific number of times.  For each iteration, the columns need to be shuffled, the above function performed and the maximum t-stat value saved to a list.</p>
  
  <p>I know that I can use the <code>sample()</code> function to shuffle the columns of the data frame, and the <code>max()</code> function to identify the maximum t-stat value, but I can't figure out how to put them together to achieve a workable code.</p>