Grid: Create a new Grid
object
Description
Create a Grid object.
Usage
Grid(levels, nlevels = NULL, dimNames = NULL, index = NULL)
Arguments
levels
A list with the levels of the variables. The length
of the list gives the spatial dimension. The $i$-th element
must be a numeric vector containing the distinct values of the
corresponding variable.
nlevels
Integer vector giving the number of levels by
dimension. This formal argument is used only when levels
is
missing. In this case, the nodes for dimension $i$ will be
regularly spaced between 0.0
and 1.0
.
dimNames
If the list levels
does not have names,
then the character vector dimNames
will be used.
index
An array with integer values and dimension
corresponding to the spatial dimensions. Each value represent the
number of the corresponding node in a "flat" representation
(data.frame or matrix), and will be used in tasks such as
interpolation.
Value
An object with S4 class "Grid"
. If needed, this
object can be coerced to a data frame or to a matrix by using the
methods as.data.frame
or as.matrix
.
Examples
myGD1 <- Grid(levels = list("X" = c(0, 1), "Y" = c(0.0, 0.5, 1.0)))
## the same with less effort
myGD2 <- Grid(nlevels = c("X" = 2, "Y" = 3))
nlevels(myGD2)
levels(myGD2)