I can never remember what melt, cast and all that means, hence I simpy use reshape() which does not even require any additional package:

reshape(dat, direction="long", idvar = "ID",
  varying=list(2:4), v.names="Value", times=names(dat)[2:4])

Uwe Ligges


On 22.09.2011 15:54, Eugene Kanshin wrote:
Hello,
I need to convert dataframe from:

ID   T0   T1   T2
A    1     2     3
B    4     5     6
C    7     8     9

to:

ID Variable Value
A       T0       1
A       T1       2
A       T2       3
B       T0       4
B       T1       5
B       T2       6
C       T0       7
C       T1       8
C       T2       9

i tried to use melt cast but it gives me all the time not exactly what I
need.
Thank you.

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

______________________________________________
R-help@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.

Reply via email to