Re: [R] for-loop with multiple variables changing

2006-02-06 Thread Peter Dalgaard
Sean Davis <[EMAIL PROTECTED]> writes: > On 2/6/06 5:53 AM, "Piet van Remortel" <[EMAIL PROTECTED]> wrote: > > > Hi all, > > > > Never really managed to build a for-loop with multiple running > > variables in an elegant way. > > > > Can anybody hint ? > > > > See below for an example of what I

Re: [R] for-loop with multiple variables changing

2006-02-06 Thread Petr Pikal
ubject: [R] for-loop with multiple variables changing > Hi all, > > Never really managed to build a for-loop with multiple running > variables in an elegant way. > > Can anybody hint ? > > See below for an example of what I would like. > > EXAMPLE

Re: [R] for-loop with multiple variables changing

2006-02-06 Thread Sean Davis
On 2/6/06 6:23 AM, "Sean Davis" <[EMAIL PROTECTED]> wrote: > > > > On 2/6/06 5:53 AM, "Piet van Remortel" <[EMAIL PROTECTED]> wrote: > >> Hi all, >> >> Never really managed to build a for-loop with multiple running >> variables in an elegant way. >> >> Can anybody hint ? >> >> See below

Re: [R] for-loop with multiple variables changing

2006-02-06 Thread Adaikalavan Ramasamy
If you want a one-to-one action between corresponding pairs of "a" and "b", then how about simply : for( i in 1:length(a) ){ print( number[i] ) print( name[i] ) } If you want the first element of "a" to work with all elements of "b", the second element of "a" to work with all elements of "b

Re: [R] for-loop with multiple variables changing

2006-02-06 Thread Sean Davis
On 2/6/06 5:53 AM, "Piet van Remortel" <[EMAIL PROTECTED]> wrote: > Hi all, > > Never really managed to build a for-loop with multiple running > variables in an elegant way. > > Can anybody hint ? > > See below for an example of what I would like. > > EXAMPLE > a<-c(1,2,3) > b<-c("name1","n

[R] for-loop with multiple variables changing

2006-02-06 Thread Piet van Remortel
Hi all, Never really managed to build a for-loop with multiple running variables in an elegant way. Can anybody hint ? See below for an example of what I would like. EXAMPLE a<-c(1,2,3) b<-c("name1","name2","name3") for( number in a, name in b ) { print( number ) ##take a value