将3行转换为3列

时间:2015-03-23 09:44:01

标签: r

我有一个数据集,我希望将3个重复的行融合成一行3列:

> tail(days,12)
        Result       type count
412  Cancelled  D_(27,32]   122
413     Failed  D_(27,32] 11113
414 Successful  D_(27,32]   141
415  Cancelled  E_(27,32]   133
416     Failed  E_(27,32]  8266
417 Successful  E_(27,32]   104
418  Cancelled  F_(27,32]    92
419     Failed  F_(27,32]  7973
420 Successful  F_(27,32]    90
421  Cancelled HR_(27,32]   328
422     Failed HR_(27,32] 33697
423 Successful HR_(27,32]   298

我想这样:

       type     Cancelled Failed Successful
    D_(27,32]   122       11113     141

我可以使用apply,但我确信有melt之类的东西可以解决我的问题。

0 个答案:

没有答案