Description Usage Arguments Details Value Author(s) References See Also Examples
View source: R/ternary.apply.R
Given 1) a ternary grid and 2) a function that takes a ternary value as its first argument, this function returns a vector formed by applying the function to each point in the grid.
1 | ternary.apply(grid, f, ...)
|
grid |
A data frame with columns |
f |
A function that accepts a length 3 vector as its first argument |
... |
Additional arguments passed to |
Results will be concatenated into a vector; it is most useful for scalar-valued functions.
A vector of results
Tim Keitt <tkeitt@gmail.com>
http://dx.doi.org/10.1016/j.ecolmodel.2012.05.020
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # See demo(trifield)
## Not run:
grid.size = 128
par(mar = rep(2, 4), oma = rep(0, 4))
tg = ternary.grid(grid.size)
f = function(x)
sin(2 * pi * x[1]) +
sin(3 * pi * x[2]) +
sin(4 * pi * x[3])
z = ternary.apply(tg, f)
tf = ternary.field(tg, z)
plot(tf)
ternary.legend()
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.