apply_Grid | R Documentation |
Grid
object.Apply a function to a Grid
object.
apply_Grid(object, fun, ...)
object |
An object with S4 class |
fun |
The function to be applied. |
... |
Further arguments to be passed to |
The function is applied to each vector combination of the levels by first
using the as.matrix
coercion.
A vector of values.
The result values are given in the order specified by the
Grid
object.
array_Grid
to reshape the result as an array.
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))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.