以下是我的意见,问题如下:
Targets <- read.csv("miR155Aicda.csv", row.names=1, sep="", header=T)
head(Targets)
T0h T0.25h T0.5h T1h T2h T3h T6h T12h T24h T48h C0h C0.25h C0.5h C1h C2h
Aicda 785 1150 707 513 1265 3268 8294 8625 7387 4397 677 911 673 737 1782
mmu-miR-155-3p 622 548 558 1213 1195 1172 1115 1883 3257 1900 499 562 584 543 580
Targets.m <- melt(Targets)
> head(Targets.m)
variable value
1 T0h 9.616549
2 T0h 9.280771
3 T0.25h 10.167418
4 T0.25h 9.098032
5 T0.5h 9.465566
6 T0.5h 9.124121
问题:如何将Aicda
和mmu-mIR-155-2p
添加为变量?
我想要这个:
ID variable value
1 Aicda T0h 9.616549
2 mmu-miR-155-3p T0h 9.280771
3 Aicda T0.25h 10.167418
4 mmu-miR-155-3p T0.25h 9.098032
5 Aicda T0.5h 9.465566
6 mmu-miR-155-3p T0.5h 9.124121
答案 0 :(得分:0)
您需要将行名称放在一列中,然后为melt
指定一个id变量:
DF <- read.table(text=" T0h T0.25h T0.5h T1h T2h T3h T6h T12h T24h T48h C0h C0.25h C0.5h C1h C2h
Aicda 785 1150 707 513 1265 3268 8294 8625 7387 4397 677 911 673 737 1782
mmu-miR-155-3p 622 548 558 1213 1195 1172 1115 1883 3257 1900 499 562 584 543 580",header=TRUE)
DF$ID <- rownames(DF)
library(reshape2)
melt(DF,id="ID")