rbind 在将向量绑定在一起时不检查列名:
l = list(row1 = c(10, 20), row2 = c(20, 10))
names(l$row1) = c("A", "B")
names(l$row2) = c("B", "A")
l
$row1
A B
10 20
$row2
B A
20 10
rbind(l$row1, l$row2)
A B
[1,] 10 20
[2,] 20 10
如何从多个列表元素中生成此矩阵,以确保列名跨行正确匹配:
A B
[1,] 10 20
[2,] 10 20