[R] Generating Data Sets -- Each with a Different Name
Ken Kelley
KKelley at nd.edu
Fri Oct 24 00:09:20 CEST 2003
Hello all.
I was wondering if anyone had insight into how I might generate a large
number of data sets/vectors, where each of the data sets/vectors have a
different name?
For example, suppose I wanted to generate N data sets/vectors, each with a
different name such as:
Random.Data.1 <- rnorm(10, 0, 1)
Random.Data.2 <- rnorm(10, 0, 1)
Random.Data.3 <- rnorm(10, 0, 1)
. .
. .
. .
Random.Data.N <- rnorm(10, 0, 1)
Because I don't want to name each data set/vector myself, I want some sort
of looping/automatic procedure to do it for me. However, I'm not sure how
to do this.
What I want is something conceptually analogous to the following:
for(i in 1:N)
{
Random.Data.i <- rnorm(10, 0, 1)
}
Note the "i" in the "Random.Data.i" vector. This is the value I want to
change for each iteration of the loop, so that I can have N data
sets/vectors automatically generated for me with different names.
Does anyone know of a method where I can accomplish such a procedure.
Thanks for your thoughts,
Ken
P.S. For those of you wondering why I would ever want to do such a thing,
it is because I need a large number of data sets to use in a Monte Carlo
study with specialized software. If I could do the simulation all is R,
then obviously I could loop the whole procedure. The program I am using has
a limited Monte Carlo facility where each of the (say 10,000) data sets
must be generated elsewhere.
More information about the R-help
mailing list