I want to pivot a data frame
My input data is as
1st Input
MSFT    AAPL    GOOG
10      20      40
1st output
Id  Symbol  Value
T1  MSFT    10
T1  AAPL    20
T1  GOOG    40
--------------------------------------
--------------------------------------
2nd Input
AAPL    GOOG
30      60
2nd output
Id  Symbol  Value
T2  AAPL    30
T2  GOOG    60
---------------------------------------------------------------------
Input1 and Input2 are generated in a for loop. Can a single line of R code can solve for both of these so that the final output is as follows.
Id  Symbol  Value
T1  MSFT    10
T1  AAPL    20
T1  GOOG    40
T2  AAPL    30
T2  GOOG    60
Performance is must. I have seen on other questions on Stackoverflow that rbind or list provide less performance than preallocated space.
 
     
     
     
     
    