My recent question concerning split data.frame has been solved using both following approaches. (Question is listed at the end.)
solution 1: Try melt from the reshape package (by Gabor)
You may may need to resort it if the order is important.
solution 2: good for large dataset (by Robert)
"If your data set is really big, i.e. bigger than R can handle in
memory, then you might want to write the data frame to disk,
manipulate it there, and then read it back in"
> Dear R folks:
> I wonder anyone has a elegent way of doing what I need to do.
> I have a data frame called with four columns: V1, V2, A1 and A2:
> V1 V2 A1 A2
> A B 1.2 2.0
> A D 1.2 4.0
> A C 2.4 2.2
> What I need to do is to convert it into the following data frame with a new column x, where x is just the stacked up of A1 and A2 placed with respective V1 and V2 in the first two columns:
> V1 V2 x
> A B 1.2
> A B 2.0
> A D 1.2
> A D 4.0
> A C 2.4
> A C 2.2