矩阵是按列储存的,也是说先储存第一列,再按顺序储存第二列,并依此类推。(当给定的行数和列数之积大于给定的向量中元素的个数时,系统会采取循环补齐方式来对矩阵进行填充),向量的赋值可以表示删除某行或者某个值。
> matrix(c(1,2,3,4,5,6),nrow = 2, ncol = 3) [,1] [,2] [,3] [1,] 1 3 5 [2,] 2 4 6 > m <- matrix(c(1,2,3,4,5,6),nrow = 2, ncol = 3) >
> matrix(c(1,2,3,4,5,6),nrow = 2, ncol = 3) [,1] [,2] [,3] [1,] 1 3 5 [2,] 2 4 6 > m <- matrix(c(1,2,3,4,5,6),nrow = 2, ncol = 3) >