假设我有一个矩阵列表:
matrix <- matrix(1:4, nrow = 2, ncol = 2)
list <- list(matrix, matrix, matrix)
Run Code Online (Sandbox Code Playgroud)
以及由函数创建的矩阵cbind():
long.matrix <- do.call(cbind, list)
[,1] [,2] [,3] [,4] [,5] [,6]
[1,] 1 3 1 3 1 3
[2,] 2 4 2 4 2 4
Run Code Online (Sandbox Code Playgroud)
我想颠倒过程来从中得到list矩阵long.matrix.
我可以用for循环手动完成,但我正在寻找类似的东西:function(long.matrix, 3)我认为应该存在.有这样的事吗?