The apply mode
In the apply
mode, the loop that is presented in the example for run is
no longer necessary. The function should accept at least a parameter x containing the whole input
row stored in a list. Its value is returned as the output row.
- nz.mode
- Equals
apply
. - nz.fun
- Accepts the parameter x, along with additional parameters from
nz.args
. - nz.args
- Contains a list with arguments for
nz.fun
(by default it is an empty list). - nz.shaper
- Required if UDX output is defined as TABLE(ANY).
- nz.shaper.args
- Optional.
- nz.shaper.list
- Required if
shaper
is set tostd
.
An example of the
apply
setup:nz.mode <- 'apply'
nz.fun <- function(x) {
return(sqrt(as.double(x[[1]])))
}
Each input row is passed as the function's sole argument. Since it can contain values of various data types, it is a list. Its elements can be accessed only by positional indices, no elements’ names are provided.