Skip to content
Prev 174397 / 398506 Next

Creating dataframe names on the fly?

I am aware that it is easily possible to create var names on the fly. e.g.
assign(paste("m",i,sep=""),j)
but is it possible to assign dataframes to variables created on the fly?

e.g. 
If I have a dataframe called master and I wanted to subset parts of those
data into separate dataframes, I could do:

m1=subset(master,master$SAMPLE=='1')
m2=subset(master,master$SAMPLE=='2')
.....

but I would like to do this in a loop. Can someone give me suggestions on
how to accomplish this?


I tried assign(paste("m",i,sep=""),subset(master,master$SAMPLE==i) with no
success.


thanks!