I'm a trying to manage a big data.frame to reshape it. I tried some little things, but as I'm newbie in R, I cannot do it as I wish
DF1 <- data.frame(V1 = c("Sample1", "Sample1", "Sample2", "Sample2"),
V2 = c("Gene1", "Gene2", "Gene1", "Gene2"),
V3 = c(12, 12, 12, 12))
I would like to reshape it as :
DF2 <- data.frame(V1 = c("NA", "Gene1", "Gene2"),
V2 = c("Sample1", 12, 12),
V3 = c("Sample2", 12, 12))
I tried to dissociate the table in small tab containing all the gene information for 1 sample and after merge them to place the gene in row. But is there a simplest way to do that?
Thanks a lot,