Re: [R] Help on nested FOR loops

2008-05-19 Thread Julian Burgos
Hey Philip, I'm not sure if I understand what your "x11", "x12", etc. are. You can combine the values of your two vectors using the expand.grid function. There is no need to do nester FOR loops: > i=c(1,2,3,4,5) > j=c(1,2,3) > x=expand.grid(i,j) > print (x) Var1 Var2 1 11 2 2

Re: [R] Help on nested FOR loops

2008-05-19 Thread Henrique Dallazuanna
Try: paste("x", as.vector(t(outer(1:4, 1:3, FUN=paste, sep=""))), sep="") or paste("x", apply(expand.grid(1:4, 1:3), 1, paste, collapse=""), sep="") On Mon, May 19, 2008 at 4:40 PM, Philip Twumasi-Ankrah < [EMAIL PROTECTED]> wrote: > I am new to more radical programming in R. I am trying to w

[R] Help on nested FOR loops

2008-05-19 Thread Philip Twumasi-Ankrah
I am new to more radical programming in R. I am trying to write a nested 'for' loop to produce output that takes subscripts like: for i taking values 1,2,3,4,5 and j taking values 1,2,3 I want to output for a computation using the combination values of i and j a value x like this; i j