Grid-class: Class '"Grid"'

Description Objects from the Class Slots Methods Examples

Description

S4 class

Objects from the Class

Objects can be created by calls of the form new("Grid", ...). or more simply by calling Grid.

Slots

dim:

Object of class "integer" Spatial dimension or number of inputs.

dimNames:

Object of class "character" Names of the spatial dimensions or inputs.

levels:

Object of class "list" List with length dim containing the levels, i.e. the distinct values taken by the corresponding spatial variable.

index:

Object of class "array" Integer index of the combination of levels.

Methods

aperm

signature(a = "Grid"): generalized transposition

as.data.frame

signature(x = "Grid"): coercion to a data frame, with one row for each combination of the levels.

as.matrix

signature(x = "Grid"): coercion to a matrix, with one row by combination of the levels.

checkX

signature(X = "Grid"): check desing.

closest

signature(X = "Grid"): find closest points.

dim

signature(x = "Grid"): spatial dimension d.

dimnames

signature(x = "Grid"): names of the spatial dimensions.

dimnames<-

signature(x = "Grid", value = ANY): replace the names of the spatial dimensions.

length

signature(x = "Grid"): number of grid nodes.

levels

signature(x = "Grid"): extracts the list of the levels, i.e. the possible distinct values for each spatial dimension.

nlevels

signature(x = "Grid"): vector of number of levels, one value for each spatial dimension.

plot

signature(x = "Grid"): plot an object using pairs.

sampleIn

signature(x = "Grid"): draw random nodes.

show

signature(x = "Grid"): show grid properties.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
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))

smint documentation built on April 14, 2017, 1:49 p.m.