[R] Restructuring data
Daniel Malter
daniel at umd.edu
Mon Jul 16 00:21:24 CEST 2007
Hi folks,
I am new to the list and relatively new to R. I am trying to unstack data
"arraywise" and could not find a convenient solution yet. I tried to find a
solution for the problem on help archives. I also tried to use the reshape
command in R and the reshape package but could not get result. I will
illustrate the case below, but the real dataset is quite large so that I
would appreciate an easy solution if there is any.
The current data structure (variable names):
ID, TIME, BUY-A, BUY-B, SELL-A, SELL-B
Achieved structure (with the reshape command or the reshape package)
ID, TIME, BUY-A
ID, TIME, BUY-B
ID, TIME, SELL-A
ID, TIME, SELL-B
This is regular unstacking with two identifier variables. Nothing special
though. What I am looking for and did not manage is the following structure:
ID, TIME, BUY-A, SELL-A
ID, TIME, BUY-B, SELL-B
I am quite sure it's pretty easy, but I could not find how to do this.
Thanks a bunch,
Daniel
More information about the R-help
mailing list