rbartpackages.base.rmethod

rbartpackages.base.rmethod(meth, *, rname=None)[source]

Automatically implement a method using the correspoding R method.

Parameters:
  • meth (FunctionType) – A method in a subclass of RObjectBase.

  • rname (str | None, default: None) – The name of the method in R. If not specified, use the name of meth.

Returns:

Callable – An implementation of the method that calls the R method, discarding the original implementation of meth.

Examples

>>> class MyRObject(RObjectBase):
...     _rfuncname = 'mypackage::myfunction'
...     @partial(rmethod, rname='my.method')
...     def my_method(self, arg1: int, arg2: str):
...         ...