next up previous
Next: Listing and sizing your Up: Working with objects Previous: Working with objects

Working indirectly with objects based on text strings:

Suppose you want to manipulate the names of objects within your code. You can do things like the following: 
>i=2 
>eval(as.name(paste("obj",i,sep=""))) # returns contents of obj2  
>assign(paste("obj",i,sep=""),obj1) # assigns contents of obj1 to obj2



Chris Paciorek 2006-04-02