Skip to content
Back to formatted view

Raw Message

Message-ID: <Pine.A41.4.58.0402191104590.44886@homer19.u.washington.edu>
Date: 2004-02-19T19:06:19Z
From: Thomas Lumley
Subject: reshape direction=wide
In-Reply-To: <E37EEC6DE3A0C5439B7E7B07406C24AE124942@msgmarsta01.bio.dfo.ca>

On Thu, 19 Feb 2004, Hanke, Alex wrote:

>
> v.names=c("var1","var2") creates a separate column for each combination of
> variables in v.names and level of variable identified by timevar.
>

yes, but that's not what he actually wants.

He needs to create a new id variable that combines ID and BID first

df$newid<-paste(df$ID,df$BID)


	-thomas

>
>
> I am reshaping a data.frame bids --> reshaped as shown below.
>
> I thought this should be possible with a single invocation of
> reshape, but the only way I came up with is reshaping subsets for each
> keyword and then joining them together. Does anyone have an idea how to
> solve this in a more elegant way? Efficiency is a concern as the datasets
> are very large.
>
> Is there a way to specify multiple v.names?
>
>
>
> Alex Hanke
> Department of Fisheries and Oceans
> St. Andrews Biological Station
> 531 Brandy Cove Road
> St. Andrews, NB
> Canada
> E5B 2L9
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

Thomas Lumley			Assoc. Professor, Biostatistics
tlumley at u.washington.edu	University of Washington, Seattle