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 ofRObjectBase.rname (
str|None, default:None) – The name of the method in R. If not specified, use the name ofmeth.
- Returns:
Callable– An implementation of the method that calls the R method, discarding the original implementation ofmeth.
Examples
>>> class MyRObject(RObjectBase): ... _rfuncname = 'mypackage::myfunction' ... @partial(rmethod, rname='my.method') ... def my_method(self, arg1: int, arg2: str): ... ...