Many thanks to everyone who helped me solve this problem. I think I must have described my problem poorly, but Phil, Patrick and Jim were able to see through the haze and suggest that I use a list to contain the output from my loop. This solution works very well.
Thanks again for your help, Mark On Thu, Mar 18, 2010 at 12:44 PM, Mark Na <mtb...@gmail.com> wrote: > Dear R helpers, > > I would like to write a loop that makes 4 objects (called A, B, C, and D) > each of which contains ten random numbers. > > This attempt: > > individuals<-c("A","B","C","D") > for(i in 1:length(individuals)) { > individuals[i]<-rnorm(10) > } > > > does not work because "individuals[i]" is not the proper way to extract > each letter from the object called "individuals" (rather, it tries to assign > the random numbers to various positions within "individual") > > So, my question is, what should be to the left of the gets operator in the > third line? > > Many thanks, > > Mark Na > -- Mark Na University of Saskatchewan Saskatoon, Canada [[alternative HTML version deleted]] ______________________________________________ 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.