]
Sent: Monday, August 03, 2009 4:57 PM
To: David Reiner dav...@rhotrading.com
Cc: R-help@r-project.org
Subject: Re: [R] Help with reshaping data.frame
On Mon, Aug 3, 2009 at 5:23 PM, dav...@rhotrading.com wrote:
I'm having trouble reshaping a data.frame from long to wide.
(I think that's the right
I'm having trouble reshaping a data.frame from long to wide.
(I think that's the right terminology; feel free to educate me.)
I've looked at the reshape function and package and plyr package,
but I can't quite figure out how to do this after a dozen variations.
I have a data.frame with more
message -
From: dav...@rhotrading.com
To: R-help@r-project.org
Date: Mon, 3 Aug 2009 16:23:22 -0500
Subject: [R] Help with reshaping data.frame
I'm having trouble reshaping a data.frame from long to wide.
(I think that's the right terminology; feel free to educate me.)
I've looked at the reshape
On Mon, Aug 3, 2009 at 5:23 PM, dav...@rhotrading.com wrote:
I'm having trouble reshaping a data.frame from long to wide.
(I think that's the right terminology; feel free to educate me.)
I've looked at the reshape function and package and plyr package,
but I can't quite figure out how to do
Try this:
tst2 - tst[-(2:3)]
tst2$timevar - with(tst, interaction(K2, K3))
reshape(tst2, dir = wide, idvar = K1, timevar = timevar)
K1 V1.D.a V2.D.a V3.D.a V1.E.a V2.E.a V3.E.a V1.D.b V2.D.b V3.D.b
V1.E.b V2.E.b V3.E.b
1 10 0.08 99105 NA NA NA NA 76775
0.11
5 matches
Mail list logo