## define a Grid object
myGD <- Grid(nlevels = c(3, 4))
bd <- boundary_Grid(myGD, type = "index")
## use a different color for boundary points
cols <- rep("black", length(myGD))
cols[bd] <- "red"
plot(myGD, col = cols, pch = 16, cex = 2, main = "Boundary points")
## repeat this after a generalised transposition
myGD2 <- aperm(myGD, perm = c(2, 1))
bd2 <- boundary_Grid(myGD2, type = "index")
cols2 <- rep("black", length(myGD2))
cols2[bd2] <- "red"
plot(myGD2, col = cols2, pch = 16, cex = 2, main = "Boundary points")
## 3-dimensional
myGD3 <- Grid(nlevels = c("x" = 3, "y"= 4, "z" = 6))
bd3 <- boundary_Grid(myGD3, type = "index")
cols3 <- rep("black", length(myGD3))
cols3[bd3] <- "red"
plot(myGD3, jitter = TRUE, col = cols3, pch = 16, cex = 2, main = "Boundary points")
Run the code above in your browser using DataLab