[R] how to store multiple data frame name and print in R?

arun smartpink111 at yahoo.com
Thu Dec 5 16:02:52 CET 2013


Hi,

May be this helps:
i<-1
li<-list()
while(i<3)
{
li[[i]]<-get(paste("L", i, sep = ""))
print(li[[i]])
i<-i+1
} 

li[[1]]
#   A  B
#1 V1 v2
#2 V2 V3



#you can also store it by:

l2 <- list(L1=L1,L2=L2,L3=L3)


A.K.




I have 3 data frame 

L1<-data.frame(A=c("V1","V2"),B=c("v2","V3")) 

L2<-data.frame(A=c("V1V2")) 

L3<-data.frame(A=c("V1V2V3")) 

is it possible to store it name in list ? 

i mean 
i<-1 
li<-list() 
while(i<3) 
{ 
li[i]<-paste("L", i, sep = "") 
print(li[i]) 
i<-i+1 
} 

expected output is 
if print li[i] 
get the value 
             A               B 
1            V1            v2 
2            V2            V3 




More information about the R-help mailing list