Skip to content
Prev 10634 / 398502 Next

collaspe into a name

On Fri, 6 Apr 2001, Erin Hodgess wrote:

            
This sort of question comes up fairly frequently. There are two parts to
the solution
 1. You could do
    bx<-get(paste("x",z,sep=""))

 2. This sort of solution usually means you are asking the wrong question.
It is rare that manipulating R commands as text strings is a good
solution. You would probably be better off with x being a list or array so
you could do eg

     x<-list(x1,x2,x3,x4)
     bx<-x[[z]]



	-thomas

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._