title: For loop R create and populate new column with output
body: <p>I've got a csv with some results. I want to loop over the results, run a power.prop.test and output the result for each row in a new column. So far I've got this:</p>
  
  <pre><code>data &lt;- read.csv("Downloads/data.csv", sep = ",", header = TRUE)
  
  for (i in 1:nrow(data)) {
    n &lt;- power.prop.test( p1 = data[i,5], p2 = data[i,6], sig.level=.1, power = .8, alternative = "one.sided")
    data &lt;- cbind(data, n[1])
  }
  head(data)
  </code></pre>
  
  <p>Rather than populating one column with the output, I'm looping through and creating a new column for ever power.prop.test I'm running. I'm binding a new column for each output instead of populating one column with each output. Issue is I'm not sure how to achieve the latter.</p>
  
  <p>If anyone has any advice on how to consolidate these outputs into one column that would be great.</p>
  
  <p>Thanks!</p>