boundary_Grid: Find boundary points in a 'Grid' object

View source: R/GridData.R

boundary_GridR Documentation

Find boundary points in a Grid object

Description

Find boundary points in a Grid object.

Usage

boundary_Grid(x, type = c("data.frame", "array", "index"))

Arguments

x

An object with class "Grid".

type

The wanted type of result.

Details

When type is "data.frame", the returned object is a data frame containing only the boundary points. When type is "array" the result is a logical array with its elements in correspondence with the index slot of the object. Finally, when type is "index", the result is an integer vector giving the indices of the boundary points in the order of the nodes defined by the object. This order is the one used by the as.data.frame coercion.

Value

An object describing the boundary points. See Details.

Note

Remind that when using the plot method for a Grid object, some nodes are generally hidden because several points have the same projection when they are shown in a two-dimensional scatterplot.

When one or more of the levels has length \leq 2, all points of the grid are boundary points!

Examples

## 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")

IRSN/smint documentation built on Dec. 9, 2023, 9:53 p.m.