[R] change object name within for loop

David Winsemius dwinsemius at comcast.net
Fri Aug 20 21:47:29 CEST 2010


On Aug 20, 2010, at 1:07 PM, Gonçalo Ferraz wrote:

> Hi,
>
> I am writing a for loop that creates one object, say 'outn' on every  
> round of the loop. I would like the name of each object to include  
> the index of the loop as in, for example:
>
> out1, out2, out3, ...

?assign
?paste

>
> And I would like the naming of the object to take place  
> automatically as the loop moves through?
>
> Similarly, I would like to be able to call different objects (in1,  
> in2, in3, ...) authomatically through the execution of the loop.

?get
?paste

>
> Is there a quick solution for this? Thank you for any help.

There are many worked examples in the archives.


>
> I apologize if this question has been addressed recently in this  
> forum - I could not find an answer online.

How did you search?

>
> Best,
>
> Gonçalo

-- 
David.


More information about the R-help mailing list