register_binding {arrow} | R Documentation |
Register compute bindings
Description
register_binding()
is used to populate a list of functions that operate on
(and return)
Expressions. These are the basis for the .data
mask inside dplyr methods.
Usage
register_binding(fun_name, fun, notes = character(0))
Arguments
fun_name |
A string containing a function name in the form |
fun |
A function, or |
notes |
string for the docs: note any limitations or differences in behavior between the Arrow version and the R function. |
Value
The previously registered binding or NULL
if no previously
registered function existed.
Writing bindings
-
Expression$create()
will wrap any non-Expression inputs as Scalar Expressions. If you want to try to coerce scalar inputs to match the type of the Expression(s) in the arguments, callcast_scalars_to_common_type(args)
on the args. For example,Expression$create("add", args = list(int16_field, 1))
would result in afloat64
type output because1
is adouble
in R. To prevent casting all of the data inint16_field
to float and to preserve it as int16, doExpression$create("add", args = cast_scalars_to_common_type(list(int16_field, 1)))
Inside your function, you can call any other binding with
call_binding()
.