  
I want to input a list into a function. But i get the error "Error in +{ : invalid argument to unary operator". How do I avoid this error? 
 
Here is an example of this problem:
 
> g = c(2, 4, 8, 16, 32, 64, 128, 122, 110, 86, 38, 76, 18, 36, 72, 10, 20, 40, 80, 26)

> for (i in 1:20)
 + {for (x in 0:20)
 + print(g[i]+x)}
[1] 2
[1] 3
[1] 4
[1] 5
[1] 6
[1] 7
[1] 8
[1] 9
[1] 10
[1] 11
[1] 12
[1] 13
[1] 14
[1] 15
[1] 16
[1] 17
[1] 18
[1] 19
[1] 20
[1] 21
[1] 22
Error in +{ : invalid argument to unary operator


      
	[[alternative HTML version deleted]]


