小编cur*_*ure的帖子

反向cbind()函数R.

假设我有一个矩阵列表:

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)我认为应该存在.有这样的事吗?

r matrix cbind

3
推荐指数
1
解决办法
1043
查看次数

标签 统计

cbind ×1

matrix ×1

r ×1