Vectorize a multidimensional Function
Vectorize a d-dimensional (input) function, in the same way that base::Vectorize for 1-dimensional functions.
Vectorize.funD(fund, d, .apply = base::apply)
fund |
d-dimensional function to Vectorize |
d |
dimension of input arguments of fund |
.apply |
which vectorization to use (default is base::apply) |
a vectorized function (to be called on matrix argument, on each row)
f = function(x)x[1]+1; f(1:10); F = Vectorize.funD(f,1); F(1:10); #F = Vectorize(f); F(1:10); f2 = function(x)x[1]+x[2]; f2(1:10); F = Vectorize.funD(f2,2); F(cbind(1:10,11:20)); #F = Vectorize(f); F(1:10);
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.