If I have several matrices that I have created, how can I combine them into one array? I have 8 matrices that each have 200 rows and 200 columns and I need to combine them into an array with dim = 200,200,8. So I want each of my matrices to be a slice of my array.
You can use the abind function from the abind package:
abind
library(abind) newarray <- abind( mat1, mat2, mat3, mat4, along=3 ) ## or if mats are in a list (a good idea) newarray <- abind( matlist, along=3 )
1.4m articles
1.4m replys
5 comments
57.0k users