有了这个代码融化所选择的单个列:如何在数据帧
dat <- structure(list(Probes = structure(1:6, .Label = c("1415670_at",
"1415671_at", "1415672_at", "1415673_at", "1415674_a_at", "1415675_at"
), class = "factor"), Genes = structure(c(2L, 1L, 4L, 5L, 6L,
3L), .Label = c("Atp6v0d1", "Copg1", "Dpm2", "Golga7", "Psph",
"Trappc4"), class = "factor"), FOO = c(1.133, 1.068,
1.01, 0.943, 1.048, 1.053)), .Names = c("Probes", "Genes", "FOO"
), row.names = c(NA, 6L), class = "data.frame")
我创建了以下数据帧:
Probes Genes FOO
1 1415670_at Copg1 1.133
2 1415671_at Atp6v0d1 1.068
3 1415672_at Golga7 1.010
4 1415673_at Psph 0.943
5 1415674_a_at Trappc4 1.048
6 1415675_at Dpm2 1.053
我想要做的是选择最后一列和把它融化如下:
FOO 1.133
FOO 1.068
FOO 1.010
FOO 0.943
FOO 1.048
FOO 1.053
我该怎么做?
我坚持用这个代码:
library(reshape2)
melt(dat[,ncol(dat)])
预期产量是多少?有2列的数据框?具有1列+行名的数据框?还有别的吗? – 2016-01-22 03:15:18