Takes a matrix x
and groups its rows (or columns)
as specified by indices
. Returns a list of matrices, one for each group.
groupData(x, indices, byrow = FALSE)
A list
of matrices (one per group).
Such a list, grouped by columns, is then typically passed on to zenplot()
.
zenplot()
which provides the zenplot.
Other tools related to constructing zenpaths:
connect_pairs()
,
extract_pairs()
,
graph_pairs()
,
indexData()
,
zenpath()
## get a matrix
x <- matrix(1:15, ncol = 3)
colGroups <- list(c(1,2), list(2:3))
rowGroups <- list(c(1,4), list(2:3))
groupData(x, indices = colGroups)
#> [[1]]
#> [,1] [,2]
#> [1,] 1 6
#> [2,] 2 7
#> [3,] 3 8
#> [4,] 4 9
#> [5,] 5 10
#>
#> [[2]]
#> [,1] [,2]
#> [1,] 6 11
#> [2,] 7 12
#> [3,] 8 13
#> [4,] 9 14
#> [5,] 10 15
#>
groupData(x, indices = rowGroups, byrow = TRUE)
#> [[1]]
#> [,1] [,2] [,3]
#> [1,] 1 6 11
#> [2,] 4 9 14
#>
#> [[2]]
#> [,1] [,2] [,3]
#> [1,] 2 7 12
#> [2,] 3 8 13
#>