showClass("Grid")
## generate a random Grid object, and change its order for tests
set.seed(1234)
GD <- randGrid(nlevels = c("X" = 2, "Y" = 3))
n <- length(GD@index)
ind <- sample(n, size = n, replace = FALSE)
GD@index <- array(ind, dim = nlevels(GD))
X2 <- as.matrix(GD)
GD2 <- as.Grid(X2)
X2Bis <- as.matrix(GD2)
## This hould be zero!
max(abs(X2 - X2Bis))
Run the code above in your browser using DataLab