[R] merge numerous columns of unequal length

Patrick Burns pburns at pburns.seanet.com
Tue May 6 10:52:31 CEST 2008


As the answers you've received suggest, you
can use a list.  Or you could have two
vectors: one with the data, the other with the
group identity.  The latter format is likely more
convenient for a lot of analyses.

Since your data are not inherently rectangular,
it is probably best to get the idea of spreadsheet
out of your head.  (It is probably best anyway.)

Patrick Burns
patrick at burns-stat.com
+44 (0)20 8525 0696
http://www.burns-stat.com
(home of S Poetry and "A Guide for the Unwilling S User")

T.D.Rudolph wrote:
> I have numerous objects, each containing continuous data representing the
> same variable, movement rate, yet each having a different number of rows.  
> e.g.
> d1<-as.matrix(rnorm(5))
> d2<-as.matrix(rnorm(3))
> d3<-as.matrix(rnorm(6))
>
> How can I merge these three columns side-by-side in order to create a table
> regardless of the difference in length?  I wish to analyze the output in a
> spreadsheet format.
>
> Thanks!
> Tyler
>



More information about the R-help mailing list