High Performance Variant of apply()
High performance variant of apply() for a fixed set of functions. However, a considerable speedup is a trade-off for universality. Only the following functions can be applied: sum(), prod(), all(), any(), min(), max(), mean(), median(), sd(), var().
arrApply(arr, idim = 1L, fun = "sum")
numeric array of arbitrary dimension
integer, dimension number along which a function must be applied
character string, function name to be applied
RcppArmadillo is used to do the job very quickly but it commes at price
of not allowing NA in the input numeric array.
Vectors are allowed at input. They are considered as arrays of dimension 1.
So in this case,
idim must be 1.
output array of dimension cut by 1. Its type (nueric or logical) depends on the function applied.
Serguei Sokol <sokol at insa-toulouse.fr>
1 2 3 4 5 6 7 8