Thanks for the reply, I realize that having x and y in that order in
"varying" and "v.names" will work.  The question is why reversing the order
(i.e., y followed by x) does not work; it seems unintuitive, so I'm
wondering if I've just misread the documentation.

On Fri, Aug 6, 2010 at 1:45 PM, Dennis Murphy <djmu...@gmail.com> wrote:

> 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.

Reply via email to