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?
Regards,
---------------------------------
Pinpoint customers who are looking for what you sell.
[[alternative HTML version deleted]]
I want to create a data-frame. any idea? Moshe Olshansky <m_olshansky@yahoo.com> wrote: What do you mean by write - write to file, create a data.frame? --- Megh Dal wrote:> 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? > > Regards, > > > > > > --------------------------------- > Pinpoint customers who are looking for what you > sell. > [[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]]
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