[R] how to create automatically names for vectors in a loop?

Erik Iverson eriki at ccbr.umn.edu
Fri May 28 05:02:09 CEST 2010


Zoppoli, Gabriele (NIH/NCI) [G] wrote:
> Hi,
> 
> I want to generate a number of vectors and store them with different names, like this:
> 
> x=1
> 
> while (x<100)
> 
>  { 
>    vector#x# = rnorm(100)
>    x=x+1
> }
> 
> where each vector has, at its hand, instead of #x# a number which goes from 1 to 99.
> 
> How can I do this?
> 

?paste and ?assign but almost surely you'd be better off storing these vectors 
in a list or matrix.



More information about the R-help mailing list