rbind does not check for column names when binding together vectors:
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
How can I produce this matrix from a number of list elements, insuring the column names are correctly matched across rows:
A B
[1,] 10 20
[2,] 10 20
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…