title: How to make a vector using a for loop
body: <p>I'm very new to R (and programming in general) and I've been stuck on this (probably very easy) question for a few days...</p>
  
  <p>How would one make the vector <code>3 6 12 24 48 96 192 384 768</code> with a <code>for</code> loop?</p>
  
  <p>All I've managed to come up with so far is something along the lines of:</p>
  
  <pre><code>x=numeric()
  for (i in 1:8) (x=2*i[-1])
  </code></pre>
  
  <p>However, that doesn't work. I think one of the main problems is that I don't understand how to index numbers in a sequence.</p>
  
  <p>If anyone could point me in the right direction that would be such a great help!</p>