field | Fund1 | Fund2 | Fund3 | Fund4 |
---|---|---|---|---|
Subdetail | Test | Test2 | Test3 | Test 4 |
Amount | 500 | 520 | 100 | 400 |
Percentage Limit | 30 | 20 | 20 | 100 |
So I have the above test table named data1. I wish to convert it to something like below:
Name | field | value |
---|---|---|
Fund1 | Subdetail | Test |
Fund1 | Amount | 500 |
Fund1 | Percentage Limit | 30 |
How should I do this? I tried:
data1 <- reshape2::melt(data1, idvar = 'field')
But it does not work