split big matrix in subsets,R -
i make subgroups matrix, , each subgroup contains same amount of column. example, there matrix 1000 rows , 420 columns, , split 35 sub-matrix in order, first 1 contains first 12 cols, , second contains second 12 cols, , on. think use function iris. please me!
iris[c()]
not sure if you're after, here's reproducible example:
# define matrix m = matrix( c(1:20), nrow=2, ncol=10) # split 5 submatrices of equal size lapply(split(m, rep(1:5, each = 4)), matrix, ncol = 2) $`1` [,1] [,2] [1,] 1 3 [2,] 2 4 $`2` [,1] [,2] [1,] 5 7 [2,] 6 8 $`3` [,1] [,2] [1,] 9 11 [2,] 10 12 $`4` [,1] [,2] [1,] 13 15 [2,] 14 16 $`5` [,1] [,2] [1,] 17 19 [2,] 18 20
Comments
Post a Comment