[R] Stacking Vectors/Dataframes

Marc Schwartz MSchwartz at MedAnalytics.com
Mon Aug 16 16:01:49 CEST 2004


Archived versions of gregmisc (and other packages) are available from:

http://cran.r-project.org/src/contrib/Archive/

Download one of the older versions (ie. 0.8.5) and install it from a
console using R CMD INSTALL.

If you are restricted from installing packages to the main R tree (ie.
you do not have the requisite permissions), see R FAQ 5.2 regarding
installing packages to alternate locations.

HTH,

Marc Schwartz

On Mon, 2004-08-16 at 08:33, Laura Quinn wrote:
> As our IT man is currently on holiday I am not able to upgrade to version
> 1.9.0(or 1.9.1) at the moment, and I see that the gregmisc library will
> not work on earlier versions (I am using 1.8.0). Does anyone have any
> other suggestions how I might be able to acheive this?
> 
> Thank you
> 
> Laura Quinn
> Institute of Atmospheric Science
> School of the Environment
> University of Leeds
> Leeds
> LS2 9JT
> 
> tel: +44 113 343 1596
> fax: +44 113 343 6716
> mail: laura at env.leeds.ac.uk
> 
> On Sun, 15 Aug 2004, Liaw, Andy wrote:
> 
> > I believe interleave() in the `gregmisc' package can do what you want.
> >
> > Cheers,
> > Andy
> >
> > > From: Laura Quinn
> > >
> > > Hello,
> > >
> > > Is there a simple way of stacking/merging two dataframes in
> > > R? I want to
> > > stack them piece-wise, not simply add one whole dataframe to
> > > the bottom of
> > > the other. I want to create as follows:
> > >
> > > x.frame:
> > > aX1  bX1  cX1  ... zX1
> > > aX2  bX2  cX2  ... zX2
> > > ...  ...  ...  ... ...
> > > aX99 bX99 cX99 ... zX99
> > >
> > > y.frame:
> > > aY1  bY1  cY1  ... zY1
> > > aY2  bY2  cY2  ... zY2
> > > ...  ...  ...  ... ...
> > > aY99 bY99 cY99 ... zY99
> > >
> > > new.frame:
> > > aX1  bX1  cX1  ... zX1
> > > aY1  bY1  cY1  ... zY1
> > > aX2  bX2  cX2  ... zX2
> > > aY2  bY2  cY2  ... tY2
> > > ...  ...  ...  ... ...
> > > aX99 bX99 cX99 ... tX99
> > > aY99 bY99 cY99 ... tY99
> > >
> > > I have tried to use a for loop (simply assigning and also
> > > with rbind) to
> > > do this but am having difficulty correctly assigning the
> > > destination in the new dataframe. Can
> > > anyone offer a quick and easy way of doing this (or even a
> > > long winded one
> > > if it works!!)
> > >
> > > Thank you in advance,




More information about the R-help mailing list