Re: [R] help for reshape function

From: Andrie de Vries <apdevries_at_yahoo.co.uk>
Date: Fri, 18 Jun 2010 03:37:59 -0700 (PDT)

Xin Wei

I have sympathy with your difficulties in understanding the reshape() function.

May I recommend using the melt() and cast() functions instead, available in the reshape package. You can find information, help and examples here:

http://had.co.nz/reshape/

This simplifies the coding of your problem dramatically:

---

library(reshape)
df <- data.frame(gene=c("gene1", "gene2", "gene3"),

                 patient1=c(10,20,100),
                 patient2=c(20,40,200),
                 patient3=c(50,60,300))
                 

melt(df, id.vars="gene")

---

Andrie

-- 
View this message in context: http://r.789695.n4.nabble.com/help-for-reshape-function-tp2259286p2260009.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Fri 18 Jun 2010 - 12:09:45 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 18 Jun 2010 - 12:20:33 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive