Skip to contents

Object that stores a function name together with its arguments. Methods are then available to get the function call and evaluate it.

Super class

teal.data::Callable -> CallableFunction

Methods

Inherited methods


Method new()

Create a new CallableFunction object

Usage

CallableFunction$new(fun, env = new.env(parent = parent.env(globalenv())))

Arguments

fun

(function)
function to be evaluated in class. This is either a function object or its name as a string.

env

(environment)
environment where function will be evaluated

Returns

new CallableFunction object


Method get_args()

get the arguments a function gets called with

Usage

CallableFunction$get_args()

Returns

arguments the function gets called with


Method get_call()

Get function call with substituted arguments in args. These arguments will not be stored in the object.

Usage

CallableFunction$get_call(deparse = TRUE, args = NULL)

Arguments

deparse

(logical value)
whether to return a deparsed version of call

args

(NULL or named list)
dynamic arguments to function

Returns

call or character depending on deparse argument


Method set_args()

Set up function arguments

Usage

CallableFunction$set_args(args)

Arguments

args

(NULL or named list)
function arguments to be stored persistently in the object. Setting args doesn't remove other args, only create new of modify previous of the same name. To clean arguments specify args = NULL.

Returns

(self) invisibly for chaining.


Method set_arg_value()

Set up single function argument with value

Usage

CallableFunction$set_arg_value(name, value)

Arguments

name

(character) argument name

value

argument value

Returns

(self) invisibly for chaining.


Method clone()

The objects of this class are cloneable with this method.

Usage

CallableFunction$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.