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...
How would one make the vector 3 6 12 24 48 96 192 384 768
with a for
loop?
All I've managed to come up with so far is something along the lines of:
x=numeric()
for (i in 1:8) (x=2*i[-1])
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.
If anyone could point me in the right direction that would be such a great help!