[R] How do you combine smaller tables into a larger one

Ben Bolker ben at zoo.ufl.edu
Tue May 16 23:02:11 CEST 2000


rbind(TableOne,TableTwo)

(you can extend this to rbind(TableOne,TableTwo,TableThree,...))
At least in this context, there doesn't seem to be anything "natural" or
preferred about cbind(TableOne,TableTwo).  I guess what you mean is that
if you want do this with c() you have to do something like

matrix(c(t(a1),t(a2)),ncol=4,byrow=TRUE)

which is admittedly pretty clumsy.

On Tue, 16 May 2000, Art Salwin wrote:

> I have a total of  n  tables, each 3 rows by 4 columns.
> How can they be combined into one large table of
> 3*n rows by 4 columns?  We want each of the smaller tables
> to
> be added "below" one another.  Simple example for n=2:
> 
> TableOne:
>   1  2  3  4
>   5  6  7  8
>   9 10 11 12
> 
> TableTwo:
>  51 52 53 54
>  55 56 57 58
>  59 60 61 62
> 
> Desired result:
> 
>   1  2  3  4
>   5  6  7  8
>   9 10 11 12
>  51 52 53 54
>  55 56 57 58
>  59 60 61 62
> 
> Essentially, we want to add rows to a matrix, when the
> "natural" 
> behavior of R is to add columns.  Does this imply that the
> solution
> would somehow involve the t() function?
> 

-- 
Ben Bolker                                  bolker at zoo.ufl.edu
Zoology Department, University of Florida   http://www.zoo.ufl.edu/bolker
318 Carr Hall/Box 118525                    tel: (352) 392-5697
Gainesville, FL 32611-8525                  fax: (352) 392-3704

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list