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

        [[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.

Reply via email to