将特定列的数据帧转换为id

时间:2018-02-16 10:54:54

标签: r reshape melt

df45 = data.frame(
       Tag = c(1,1,1,1,1,2,2,2,2,2),
       clus = c("L1","L2","L3","L4","L5","L1","L2","L3","L4","L5"),
       long = runif(1:10,1,2),
       medium = runif(1:10,1,2),
       short = runif(1:10,1,2),
       urgent = runif(1:10,1,2))

这是我试图转动的数据。

enter image description here

这是预期的输出显示图像,开始使用我尝试下面的代码,但我无法达到所需的结果。

    melt(df45 , id.var = "Tag")

0 个答案:

没有答案