Re: [R] store and retrieve object names in a vector

From: Kjetil Brinchmann Halvorsen <kjetilbrinchmannhalvorsen_at_gmail.com>
Date: Tue 13 Dec 2005 - 00:25:42 EST

zhihua li wrote:
> hi netters,
>
> suppose i have a series of objects X1, X2, B1,C1........... they all
> have the same dimensions. i want to combine into one by using cbind:
> y<-cbind(X1,X2,B1,C1.....)
>
> but i don't want to type the names of these objects one by one. instead,
> i've put their names into a vector: x<-c("X1","X2","B1","C1",....)

Something like:

do.call(rbind, lapply(x,get)) # not tested should work!

Kjetil

>
> i used y<-cbind(x). but what i got is a matrix of the names, not a
> combination of matrices.
>
> anybody know how to handle this?
>
> thanks a lot!
>
>
> ------------------------------------------------------------------------
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Tue Dec 13 00:32:57 2005

This archive was generated by hypermail 2.1.8 : Tue 13 Dec 2005 - 02:28:20 EST