Object that stores function name with its arguments. Methods to get call and run it.
Methods
Method new()
Create a new CallableCode object
Arguments
env
(environment)
environment where the call will be evaluated
Returns
new CallableCode object
Method assign_to_env()
Assigns x <- value object to env. Assigned object can't
be modified within local environment as it will be locked by using
lockBinding. This also means that this object can't be reassigned
which will throw an error.
Usage
Callable$assign_to_env(x, value)
Arguments
x
(character value)
name of the variable in class environment
value
(data.frame)
object to be assigned to x
Returns
(self) invisibly for chaining.
Method run()
Execute Callable function or code.
Usage
Callable$run(return = TRUE, args = NULL, try = FALSE)
Arguments
return
(logical value)
whether to return an object
args
(NULL or named list)
supplied for callable functions only, these are dynamic arguments passed to function.
Dynamic arguments are executed in this call and are not saved which means that
self$get_call() won't include them later.
try
(logical value)
whether perform function evaluation inside try clause
Returns
nothing or output from function depending on return
argument. If run fails it will return object of class simple-error error
when try = TRUE or will stop if try = FALSE.
Method is_failed()
Check if evaluation of the function has not failed.
Returns
(logical) TRUE if evaluation of the function failed or FALSE
if evaluation failed or function hasn't yet been called.
Method get_error_message()
Get error message from last function execution
Usage
Callable$get_error_message()
Returns
(character) object with error message or character(0) if last
function evaluation was successful.
Method clone()
The objects of this class are cloneable with this method.
Usage
Callable$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.