Message-ID: <Pine.A41.4.61b.0411220737520.234728@homer05.u.washington.edu>
Date: 2004-11-22T15:39:19Z
From: Thomas Lumley
Subject: variable object naming
In-Reply-To: <loom.20041122T062421-246@post.gmane.org>
On Mon, 22 Nov 2004, Gabor Grothendieck wrote:
> Benjamin M. Osborne <Benjamin.Osborne <at> uvm.edu> writes:
>
> :
> : Is it possible to give a temporary object a name that varies with each run
> of a
> : foreloop? For example, I want to fill a matrix every time I run a loop, and
> I
> : want a new matrix with each run, with an appropriate new name.
> : i.e.:
> : for(i in 1:5){... matrix.i<-some values ...}
> :
> : so that in the end I would have:
> : matrix.1
> : matrix.2
> : matrix.3
> : matrix.4
> : matrix.5
>
>
> See 7.1 of the FAQ.
>
Especially the part that says this probably isn't what you want to do. You
would likely be better off with a list, and doing
matrixlist[[i]]<-some_values
-thomas