0

这是我的输入,问题如下:

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

问题:如何添加Aicdammu-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
4

1 回答 1

0

您需要将行名放在一列中,然后为 id 指定一个变量melt

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")
于 2013-04-20T08:40:53.623 回答