title: R - Saving the values from a For loop in a vector or list
body: <p>I'm trying to save each iteration of this for loop in a vector.</p>
  
  <p><code>for (i in 1:177) {
      a &lt;- geomean(er1$CW[1:i])
  }</code></p>
  
  <p>Basically, I have a list of 177 values and I'd like the script to find the cumulative geometric mean of the list going one by one. Right now it will only give me the final value, it won't save each loop iteration as a separate value in a list or vector.</p>