title: Apply prop.table function to list elements in R
body: <p>I have created a series of tables in a list in R that I would like to run prop.test on in R. I'm trying to run proportion tests on a number large number of dummy variables in a large dataset. I created the tables as follows:</p>
  
  <p><code>&lt;- colnames(mydata[, 1:100])
  t &lt;- lapply(c, function(i) {
  table(mydata$treatment, mydata[, i])
  })</code></p>
  
  <p>Now I want to apply the function prop.test to each of the tables in the list generated by the previous code:</p>
  
  <pre><code>p &lt;- lapply(c, function(d) {prop.test(t[[d]])})
  </code></pre>
  
  <p>But this doesn't seem to work. However,</p>
  
  <p><code>prop.test(t[[1]])</code></p>
  
  <p>Does give me the proportion test for the first table in the list.</p>
  
  <p>Any thoughts??</p>