我在R中有两个(或更多)尺寸相同的表。
table1 <- as.table(matrix("TOP", nrow=4, ncol=2 ))
table2 <- as.table(matrix("BOTTOM", nrow=4, ncol=2 ))
> table1
A B
A TOP TOP
B TOP TOP
C TOP TOP
D TOP TOP
> table2
A B
A BOTTOM BOTTOM
B BOTTOM BOTTOM
C BOTTOM BOTTOM
D BOTTOM BOTTOM
我想将它们逐行绑定在一起。相比之下,rbind
给了我
> rbind(table1,table2)
A B
A "TOP" "TOP"
B "TOP" "TOP"
C "TOP" "TOP"
D "TOP" "TOP"
A "BOTTOM" "BOTTOM"
B "BOTTOM" "BOTTOM"
C "BOTTOM" "BOTTOM"
D "BOTTOM" "BOTTOM"
当我想要的是
> something(table1,table2, byrow=TRUE)
A B
A "TOP" "TOP"
A "BOTTOM" "BOTTOM"
B "TOP" "TOP"
B "BOTTOM" "BOTTOM"
C .....