Hallo,

x=1

while (x<100)

{
  vectorx<- rnorm(100)
   assign(paste("vector",x,sep=""),vectorx)
x=x+1

}
ls()

HTH
Lukas Schefczyk

--------------------------------------------------
From: "Zoppoli, Gabriele (NIH/NCI) [G]" <zoppo...@mail.nih.gov>
Sent: Friday, May 28, 2010 4:43 AM
To: <r-help@r-project.org>
Subject: [R] how to create automatically names for vectors in a loop?

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?

Thanks

Gabriele Zoppoli, MD
Ph.D. Fellow, Experimental and Clinical Oncology and Hematology, University of Genova, Genova, Italy
Guest Researcher, LMP, NCI, NIH, Bethesda MD

Work: 301-451-8575
Mobile: 301-204-5642
Email: zoppo...@mail.nih.gov
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to