title: Writing a for loop with the output as a data frame in R
body: <p>I am currently working my way through the book 'R for Data Science'.</p>
  
  <p>I am trying to solve this exercise question (21.2.1 Q1.4) but have not been able to determine the correct output before starting the for loop. </p>
  
  <blockquote>
    <p>Write a for loop to:
    Generate 10 random normals for each of μ= −10, 0, 10 and 100.</p>
  </blockquote>
  
  <p>Like the previous questions in the book I have been trying to insert into a vector output but for this example, it appears I need the output to be a data frame?</p>
  
  <p>This is my code so far:</p>
  
  <pre><code>values &lt;- c(-10,0,10,100)
  output &lt;- vector("double", 10)
  
  for (i in seq_along(values)) {
    output[[i]] &lt;- rnorm(10, mean = values[[i]])
  } 
  </code></pre>
  
  <p>I know the output is wrong but am unsure how to create the format I need here. Any help much appreciated. Thanks!</p>