title: How do I use a loop to store values into a vector?
body: <p>The vector needs to have 1000 values, and each value comes from taking the mean of a sample from a larger set of data. Here is my code:</p>
  <pre><code>xbar10 &lt;- numeric()
  for (i in 1:1000) {
    xbar10 &lt;- mean(sample(X, 10))
  }
  </code></pre>
  <p>I want to use a loop to store each new value from the <code>mean(sample(X, 10))</code> into my new vector <code>xbar10</code> but I'm having trouble getting it to store 100 values, it just returns one.</p>