Stores a user-defined element-wise function under the given name so that it
can be retrieved by get_eltwise() and invoked during query evaluation.
Arguments
- name
Op name (character scalar, matches token in query strings).
- fn
Function
function(x, ...)wherexis a numeric vector or matrix (eltwise ops preserve shape) and...collects named parameters.- overwrite
Logical scalar; set to
TRUEto replace an already- registered operation.- source
Optional
"file:line"string identifying where the registration happened. Used in the conflict error message; auto-captured from the caller's srcref if omitted.
Examples
register_eltwise("Clamp01", function(x, ...) pmin(pmax(x, 0), 1),
overwrite = TRUE)
registered_eltwise()
#> [1] "Abs" "Clamp" "Clamp01" "Convert" "Exp"
#> [6] "Fraction" "Log" "Round" "Significant" "Sqrt"