## 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)
groupData(x, indices = rowGroups, byrow = TRUE)
Run the code above in your browser using DataLab