Stores a user-defined reduction function under the given name so that it
can be retrieved by get_reduction() 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 column 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_reduction("Median_example", function(x, ...) median(x, ...), overwrite = TRUE)
registered_reductions()
#> [1] "Count" "GeoMean" "Max" "Mean"
#> [5] "Median" "Median_example" "Min" "Mode"
#> [9] "Quantile" "Std" "StdN" "Sum"
#> [13] "Var" "VarN"