subset_Grid: Subgrid by selection of levels in one dimension.

Description Usage Arguments Value Note See Also Examples

Description

Subgrid by selection of levels in one dimension.

Usage

1
subset_Grid(X, subset, type = c("index", "Grid", "both"), drop = TRUE)

Arguments

X

An object with class "Grid".

subset

An expression concerning one of the dimension of X. This can be compared to an expression in the subset method.

type

The wanted type of result. When type is "index", the returned result is an integer vector containing the indices of the subgrid nodes in the original grid. When type is "Grid" the result is the subgrid as an object of this class. Finally when type is "both" a list is returned containing the two previous types of result under the names index and Grid.

drop

Logical. If TRUE and if only one level is selected with subset then the corresponding dimension of the (flat) Grid result will be dropped.

Value

A vector of integer indices, a Grid object or a list embedding these two elements, depending on the value of type.

Note

The new Grid returned (if any) uses consecutive numbers for the nodes between 1 and the number of new nodes. So it no longer keeps trace of the nodes position in X. However the surviving nodes are kept in the order that they had in X.

When a response vector or matrix say Y is related to the original grid X, the index vector returned by subgrid can be used to select the corresponding responses.

See Also

The subset method.

Examples

1
2
3
myGD <- Grid(levels = list("Temp" = c(250, 260, 280, 290, 300),
                           "Press" = c(3, 4, 6, 10)))
myGD2 <- subset_Grid(myGD, subset = Temp > 280)

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