From andy_liaw at merck.com  Tue Jul 27 21:57:24 2004
From: andy_liaw at merck.com (Liaw, Andy)
Date: Tue Jul 27 21:58:21 2004
Subject: [Rd] dynamic creation of matrix objects (PR#7136)
Message-ID: <3A822319EB35174CA3714066D590DCD504AF8122@usrymx25.merck.com>

How is this a bug?  You get exactly what you _should_ get (or otherwise it
might have been a legitimate bug report).

I suspect what you really should use is assign().

Andy

> From: cliff@research.telcordia.com
> 
> I am trying to assign the values in a matrix to an object 
> whose name is 
> created dynamically, i.e., using eval-parse-text-paste sequence.  It 
> seems that only the very last value in the matrix is assigned 
> to the new 
> object.  I have included an example below where I create a 
> matrix object 
> called "aMat".  I can assign the contents of aMat to another object 
> called "thisMat."  However, when I attempt to make a similar 
> assignment 
> to a new object called "thatMat", only the last value is 
> returned, when 
> queried.  Does anybody know whether this is a bug...or am I doing 
> something wrong?
> 
> Cliff Behrens
> 
>  > aMat<- matrix(c(1,2,3,4,5,6,7,8),ncol=2)
>  > aMat
>      [,1] [,2]
> [1,]    1    5
> [2,]    2    6
> [3,]    3    7
> [4,]    4    8
>  > thisMat<- aMat
>  > thisMat
>      [,1] [,2]
> [1,]    1    5
> [2,]    2    6
> [3,]    3    7
> [4,]    4    8
>  > tName<-"that"
>  > eval(parse(text=paste(tName,"Mat <-",aMat,sep="")))
>  > thatMat
> [1] 8
>  >
> 
> ______________________________________________
> R-devel@stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-devel
> 
>


[Rd] dynamic creation of matrix objects (PR#7136)
Liaw, Andy