visitorClasses | R Documentation |
These two classes provide a simple means to identify a
visitor function along with a way to retrieve the results.
The S4CursorVisitor
is an S4 class with two slots - update and result
which store the visitor function and the function to retrieve the
result.
It is expected that these are generated as a closure with a shared environment.
The RefCursorVisitor
class is a reference class that one can extend
(via setRefClass
and its contains
parameter)
and implement its update and result methods.
The purpose of these classes is that one can pass an object of either
of these classes to visitTU
and it can extract and use the
visitor function and then call the result function and return that
value in one step. This is merely syntactic sugar and convenience for
avoiding creating the visitor, passing the update function to
visitTU
and then explicitly calling the resut method.
It allows one to turn three expressions into a single
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.