我试图找到一种简单的方法将列值转换为行值
我的输入数据如下
mydata <- structure(list(Group.1 = c("test1", "test2", "test3", "test4",
"test5"), a = c(470, 646, 855, 660.5, 87), b = c(5696, 5376,
5279.5, 7472, 3900), c = c(393.5, 279, 297, 201, 119)), class = "data.frame", row.names = c("1",
"2", "3", "4", "5"))
Group.1 a b c
1 test1 470.0 5696.0 393.5
2 test2 646.0 5376.0 279.0
3 test3 855.0 5279.5 297.0
4 test4 660.5 7472.0 201.0
5 test5 87.0 3900.0 119.0
我要实现的转换是这样的输出:
Group.1 var value
1 test1 a 470.0
2 test1 b 5696.0
3 test1 c 393.5
4 test2 a 646.0
5 test2 b 5376.0
...
这可能吗?