Hi, I am trying to reshape data by two identifiers: date and id. The origianl data I have can be simplified as follow;
date id v12000 1 992001 1 841997 2 741998 2 891999 2 482000 2 432001 2 452002 2 49
And I need to change the original data into the matrix as below;
date id1 id21997 . 741998 . 891999 . 482000 99 432001 84 452002 . 49
I used to use nested for loop that goes through every elemnt in the original data and copy it into the matrix I need to generate if both of date and id are matched. But now, the length of original data is over 3 mil and it took me more than 30 min. to make the matrix I want. And I don't think plain reshape function can solve this problem. Can anyone help me to solve this problem? Thank you.
Minsoo
Best Answer