我想对向量进行矢量化处理,以获得“每行”的值。例如:
mat = matrix(1:4,ncol=2)
mat
[,1] [,2]
[1,] 1 3
[2,] 2 4
c(mat) # or as.vector(mat). Both give the values "per columns"
[1] 1 2 3 4
我想得到这个:
[1] 1 3 2 4
首先转置矩阵,例如c(t(mat))
。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句