Skip to content

How do you combine smaller tables into a larger one

2 messages · Art Salwin, Ben Bolker

#
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?
#
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: