Apply a function on all values or over a given dimension of an mcnode object. May be used for all mcnode of an mc object.
1 |
x |
A mc or a mcnode object. |
margin |
The dimension on which applying the function. Maybe "all" (default) to apply the function on all values, "var" to apply the function on the variability dimension, "unc" to apply the function on the uncertainty dimension, or "variates" to apply the function on the variates. Watch out: do not use 'var' for 'variates' |
fun |
The function to be applied. When applied to a vector of length n, fun should return a vector of length n or 1. |
... |
Optionnal arguments to fun. |
If fun returns a function of length n or if margin="all", the returned mcnodes are of type and dimension of x. In other cases, the type of mcnode is changed.
apply
, mc
, mcnode
.
1 2 3 4 5 6 7 |
Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
All documentation is copyright its authors; we didn't write any of that.