我想要做的是给出一个列表[mat1,mat2,mat3,...,matn],其中每个矩阵是4x4创建一个大的4nx4矩阵:
mat1
mat2
mat3
我使用循环做了这个,但我的列表大约是12000个矩阵,它花了很长时间......我怎么能以更有效的方式做到这一点?
do.call(rbind, list(mat1, mat2, mat3))
Run Code Online (Sandbox Code Playgroud)
要么
## Collect the matrices into a list
MATS <- lapply(paste0("mat", 1:n), function(x) get(x))
## rbind them all into one
do.call(rbind, MATS)
Run Code Online (Sandbox Code Playgroud)