我有一个像:
的CSVX;pre;rec;acc;ck;f1;split
LR_rob;0.7601111111111111;0.7555555555555555;0.7617647058823529;0.7531786661542089;0.7307248677248678;0.2
LR_std;0.7525555555555556;0.7433333333333334;0.75;0.7410209587038171;0.7195873015873017;0.2
lgbm_mm;0.3763095238095238;0.4411111111111111;0.4617647058823529;0.441485266926487;0.3753897583897584;0.2
svc_std;0.6774444444444445;0.6666666666666666;0.6705882352941177;0.6588154438653449;0.6429312169312169;0.2
LR_rob;0.7860317460317461;0.7522222222222222;0.7611650485436894;0.7524750633064888;0.7425695045695047;0.30000000000000004
LR_std;0.7695634920634921;0.7372222222222222;0.7475728155339806;0.7383979401950105;0.7245416065416067;0.30000000000000004
lgbm_mm;0.39131716431716423;0.42055555555555557;0.4466019417475728;0.4254108697199608;0.36370778728209074;0.30000000000000004
svc_std;0.6906137566137567;0.6449999999999999;0.6543689320388351;0.6417800021360399;0.6289717319717321;0.30000000000000004
LR_rob;0.7613078403078404;0.7380000000000001;0.7470588235294118;0.7380051869051215;0.727810568516451;0.4
LR_std;0.7755911495911496;0.7400000000000001;0.7470588235294119;0.7380295005160757;0.7335946460946461;0.4
lgbm_mm;0.33743822866733086;0.40744444444444444;0.4279411764705882;0.40664268677985216;0.32988536288314635;0.4
svc_std;0.6989995189995191;0.6582222222222222;0.6647058823529411;0.6526916666574862;0.6402975445034269;0.4
LR_rob;0.7644878639878641;0.7220158730158731;0.7305882352941178;0.7209697443020595;0.7197011362104242;0.5
LR_std;0.7685160765160766;0.7286666666666667;0.7352941176470589;0.725877951589923;0.7261442668671771;0.5
lgbm_mm;0.27476195244757634;0.3281587301587302;0.3529411764705882;0.32821193176272556;0.25725866550917487;0.5
svc_std;0.662350502982856;0.6127619047619047;0.6188235294117648;0.6052152075406048;0.6023778428886788;0.5
LR_rob;0.7329060754060756;0.6989444444444444;0.7058823529411764;0.69540107401095;0.6892837661707631;0.6
LR_std;0.7365033115033116;0.6938333333333333;0.7009803921568627;0.6903180864256893;0.6861666486821287;0.6
lgbm_mm;0.0011437908496732027;0.03333333333333333;0.03431372549019608;0.0;0.0022116903633491313;0.6
svc_std;0.6418460319636791;0.6021349206349206;0.6088235294117648;0.5947785940250395;0.5879620052302782;0.6
LR_rob;0.7038516090095375;0.6723489658489659;0.6786610878661088;0.6672596897316149;0.6564496411100573;0.7000000000000001
LR_std;0.7021529557536086;0.6774682539682539;0.6836820083682008;0.6724406116126357;0.6636881763280612;0.7000000000000001
lgbm_mm;0.0011436541143654115;0.03333333333333333;0.03430962343096235;0.0;0.0022112663793478734;0.7000000000000001
svc_std;0.586082115040252;0.5403227513227514;0.5464435146443515;0.5301844788780261;0.5112531767027028;0.7000000000000001
LR_rob;0.6227373558626554;0.5905801050801051;0.5977941176470587;0.5833820245815239;0.5728011528128449;0.8
LR_std;0.638939877550337;0.6046491101491102;0.6088235294117647;0.5948559367468219;0.5867702047184877;0.8
lgbm_mm;0.0011519607843137253;0.03333333333333333;0.03455882352941177;0.0;0.0022267652675769583;0.8
svc_std;0.49867745208906084;0.466505698005698;0.4683823529411765;0.44935340834341775;0.4298698901530284;0.8
装入一个小组。
我如何重塑它以便第一列(X),即ID和2列,即metric_name
和metric_value
仍然存在?
我玩tidy::gather()
,但到目前为止只能获得单列重塑。
答案 0 :(得分:2)
df %>%
gather(key = "metric_name", value = "metric_value", pre:split)