W3School TIY Editor
W3School 在线教程
改变方向
暗黑模式
# 合并矩阵 Matrix1 <- matrix(c("apple", "banana", "cherry", "grape"), nrow = 2, ncol = 2) Matrix2 <- matrix(c("orange", "mango", "pineapple", "watermelon"), nrow = 2, ncol = 2) # 按行添加(将 Matrix2 的行添加到 Matrix1 的下方) Matrix_Combined <- rbind(Matrix1, Matrix2) Matrix_Combined # 按列添加(将 Matrix2 的列添加到 Matrix1 的右侧) Matrix_Combined <- cbind(Matrix1, Matrix2) Matrix_Combined