[R] Rearranging dataset
Dieter Menne
dieter.menne at menne-biomed.de
Thu Oct 11 08:36:37 CEST 2007
Megh Dal <megh700004 <at> yahoo.com> writes:
>
> Hi all, I have a datasei like this :
>
> ID Date Price
> aa 01/01/07 12
> aa 01/02/07 13
> bb 01/01/07 23
> bb 01/02/07 12
>
>
> Now I want to write them in following format :
>
> ID Date Price ID Date Price
> aa 01/01/07 12 bb 01/01/07 23
> aa 01/02/07 13 bb 01/02/07 12
>
> Is there any way to do this by some automated way?
The closest guess is to use reshape(... direction= "wide"). Be warned, reshape
is powerful and has a somewhat complex syntax. The alternative is to use the
package reshape by Hadley Wickham.
Dieter
More information about the R-help
mailing list