Re: [R] Calling objects in a loop

2009-04-20 Thread Jorge Ivan Velez
Hi Brendan, If you really, really want to work with the for() loop, then for(i in 1:10){ assign(paste("theta1_",i,sep=""),data.frame(scale(rnorm(250 assign(paste("theta2_",i,sep=""),data.frame(scale(rnorm(250 assign(paste("theta3_",i,sep=""), get(paste("

Re: [R] Calling objects in a loop

2009-04-20 Thread Dimitri Liakhovitski
Brendan, I think you should create objects outside of the "for" loop. You can't create objects instide the loop. You can try this: metalist1<-list() for(i in 1:10) {metalist1[[i]]<-assign(paste("theta1_",i,sep=""),data.frame(scale(rnorm(250} lapply(metalist1,function(x){print(dim(x))}) # Che

Re: [R] Calling objects in a loop

2009-04-20 Thread Duncan Murdoch
On 4/20/2009 2:35 PM, Brendan Morse wrote: Hi everyone, I am trying to calculate a particular variable (vector) from some previously defined variables in a loop but I am having trouble figuring out how to get the loop to recognize that it should index for the previously defined objects. Here is a

[R] Calling objects in a loop

2009-04-20 Thread Brendan Morse
Hi everyone, I am trying to calculate a particular variable (vector) from some previously defined variables in a loop but I am having trouble figuring out how to get the loop to recognize that it should index for the previously defined objects. Here is a simplified version of what I am trying to do