[R] Storing vectors as vectors and iterating through them
Ken Termiso
jerk_alert at hotmail.com
Mon Apr 18 19:08:32 CEST 2005
Hi all,
I have a bunch of int vectors. Each vector holds a bunch of ints that
correspond to row numbers of an existing matrix. I use the int vectors to
pull out rows of data from a matrix, i.e.
data <- my_matrix[int_vector,]
I would like to store these int vectors in some sort of data structure that
will preserve them as-is and allow iteration. I guess what I'm looking for
would be something analogous to the java Vector class, as in this java-like
pseudocode :
Vector V = new Vector;
V.add(a,b,c) // where a,b,c are lists
for(int i = 0; i<V.size; i++)
{
List L = (List)Vector.get(i);
plot(L);
}
The point is to iterate through the data structure containing the int
vectors, and, for each int vector, do some clustering and plotting, but what
I cannot find is a data structure in R that would support this.. trying
c(a,b,c) does not preserve each int vector, but instead merges all the ints
into one vector. I need to keep them separate (so I can create a separate
plot for each vector).
Thanks in advance,
Ken
More information about the R-help
mailing list