I need to make the following calculation:
a1= 100+1 a2 = 100+2 ... a10 = 100+10
I try to loop this as follows:
z = 1
while(z<11) {
z = z+1
a = 100+z
}
How can I make R store my results as a1, a2,...a10? I know I need to use "paste" and perhaps "assign", but I can't figure it out. Thank you very much for your help!
Edit: Thank you very much for your quick and helpful replies. I now also found a way to make it work (not as nice as yours though):
z = 0
while(z<10) {
z = z+1
x = 100+z
assign(paste("a",z, sep=""),x)
}
Again, thank you very much!
Cheers, Chris