title: R: Find the maximum value of each simulated iteration in R
body: <p>I need to record the maximum value of 5 observations, simulated 10,000 times.  This is in order to find the mean of these maximum values.  </p>
  
  <p>My current code looks like this:</p>
  
  <pre><code>mc.sim1 = function(){
     mu = 20; sigma = 4
     (rnorm(5, mu, sigma))
  }
  
  m = replicate(10000, mc.sim1())
  </code></pre>
  
  <p>I'm at a loss to explain how to record the maximum of each iteration, rather than the maximum of the whole simulated set using the 'max' function.</p>