Re: [R] help for reshape function

2010-06-18 Thread Andrie de Vries
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 yo

Re: [R] help for reshape function

2010-06-17 Thread Joshua Wiley
Hello, Try this, it is based off of your sample wide format data. I am not quite sure how you got the 'gene1' column in your desired output data, it looks like it is just the data from patient1, but since I was not sure, I did not include it. ## temp <- data.frame

Re: [R] help for reshape function

2010-06-17 Thread xin wei
I am afraid that your solution is not solving the problem. it seems that timevar="gene" just create the followings: GENESAMPLE value id 1.11 Kidney 3.69351 1 2.11 Kidney 5.42710 2 3.11 Kidney 5.26883 3 4.11 Kidney 2.88098 4 5.11 Kidney 4.68519

Re: [R] help for reshape function

2010-06-17 Thread Henrique Dallazuanna
Try this: reshape(x, direction = 'long', varying = list(3:5), timevar = "gene", v.names = "value") On Thu, Jun 17, 2010 at 3:22 PM, xin wei wrote: > > hi, everyone: > > i have a question on the reshape function. i have the following dataset : > gene tissuepatient1 patient2 patient3..

[R] help for reshape function

2010-06-17 Thread xin wei
hi, everyone: i have a question on the reshape function. i have the following dataset : gene tissuepatient1 patient2 patient3. _ gene1 breast 10 20 50 gene2 breast 20 40 60 gene3 br