doe

Serpentine design and sorting

Take a grid and serpentine it row-wise or column-wise This fn joins two matrices alternately columnwise, which is why this is the source of inspiration for generating serpentine design. alternate.cols <- function(m1, m2) { cbind(m1, m2)[, order(c(seq(ncol(m1)), seq(ncol(m2))))] } A custom function to create a serpentine design in whatever fashion specified: