Hi: Is this what you were aiming for?
reshape(d,varying=list(c("x1","x2"), c("y1","y2")),v.names=c("x","y"),dir="long") time x y id 1.1 1 1 5 1 2.1 1 2 6 2 1.2 2 3 7 1 2.2 2 4 8 2 HTH, Dennis On Fri, Aug 6, 2010 at 10:28 AM, Krishna Tateneni <taten...@gmail.com>wrote: > Hello, > > A quick question for my edification. When I run the following (R 2.8.1 on > Microsoft Windows): > > > d = data.frame(x1=c(1,2),x2=c(3,4),y1=c(5,6),y2=c(7,8)) > > reshape(d,varying=c("y1","x1","y2","x2"),v.names=c("y","x"),dir="long") > > I found myself surprised by the results--the column labeled "y" is actually > the data from "x1" and "x2", and the column labeled "x" is actually the > data > from "y1" and "y2". > > Is this behaviour of reshape as intended? That is, have I missed something > in the documentation? > > Many thanks for any comments. > > --Krishna > > [[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. > [[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.