[R] adding rows to table

Galanidis Alexandros agal at env.aegean.gr
Wed Sep 17 12:36:22 CEST 2008


Greetings everyone,

I'm trying to add a specific table or a specific number of rows (e.g.44) to a table with no success.

This is my basic table
> head(dataA)
  year    plot  spp       prop.B        DCA1    DCA2    DCA3    DCA4
1 2000    1    a1      0.031079  -0.0776 -0.0009  0.0259 -0.0457
2 2000    1    a2      0.968921  -0.0448  0.1479 -0.1343  0.1670
3 2000    2    a1      0.029218  -0.0776 -0.0009  0.0259 -0.0457
4 2000    2    a4      0.021678  -0.3052 -0.0275 -0.0330 -0.0516
5 2000    2    a5      0.088596   0.0357 -0.0382  0.0171 -0.0471
6 2000    2    a6      0.065033   0.1219 -0.0588 -0.1119 -0.1795

I want, every time that the plot number changes, to add a specific table (data2) or a specific number of rows (44) underneath.

I've tried several variations of this with no result

for (i in 2:nrow(dataA))
{

ifelse(dataA$plot[i]!=dataA$plot[i-1],tab=data.frame(res[1:i,1:3]),a=1+1)


rbind(as.matrix(dataA[1:i,]),as.matrix(dataB[,])),a=1+1)


}


many thanks



More information about the R-help mailing list