title: R iterate over columns dataframe
body: <p>I want to apply statistics to the columns of a dataframe in an iterated fashion:</p>
  
  <p>columns number 1: 'A' represents the tags that I want to discriminate:</p>
  
  <pre><code>for (i in names(dataframe)) {
      i &lt;- as.name(i)
      group1 &lt;- i[A=="locationX"]
      group2 &lt;- i[A!="locationX"]
      p &lt;- wilcox.test(group1,group2,na.action(na.omit))$p.value
  }
  </code></pre>
  
  <p>however, the <code>as.name()</code> is to try to remove the inverted commas from the column names generated by <code>names(dataframe)</code>.</p>
  
  <p>Unfortunately it gives me the error:</p>
  
  <blockquote>
    <p>Error in i[A == "locationX"] : 
      object of type 'symbol' is not subsettable</p>
  </blockquote>
  
  <p>I think <code>as.name()</code> is not the right way to do it.</p>
  
  <p>Any clues?</p>