apply_Grid: Apply a function to a 'Grid' object.

Description Usage Arguments Details Value Note See Also Examples

Description

Apply a function to a Grid object.

Usage

1
apply_Grid(object, fun, ...)

Arguments

object

An object with S4 class "Grid"

fun

The function to be applied.

...

Further arguments to be passed to fun.

Details

The function is applied to each vector combination of the levels by first using the as.matrix coercion.

Value

A vector of values.

Note

The result values are given in the order specified by the Grid object.

See Also

array_Grid to reshape the result as an array.

Examples

1
2
3
4
5
myGD <- Grid(levels = list("X" = c(0, 1),
                           "Y" = c(0.0, 0.5, 1.0),
                           "Z" = c(0.0, 0.2, 0.4, 1.0)))
## gaussian function
apply_Grid(myGD, fun = function(x) exp(-x[1]^2 - 3 * x[2]^2 - 2 * x[3]^2))

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