Description Usage Arguments Details Value Author(s)
RCacheSuite allows users to specify custom evaluation functions, which can be used to capture information about side effects, and return value handlers, which can then use that information to recreate the side effects.
In practice, the behavior of the default evaluation function
(parseWithVis
) and return handler (withVizHandler
) should meet
users' needs the majority of the time.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | parseEval(code, env, ...)
parseWithVis(code, env, ...)
withVisHandler(val, graphics, env, evaled = FALSE, last = FALSE, ...)
withVisRaw(val, graphics, env, evaled = FALSE, last = FALSE, ...)
returnRaw(val, graphics, env, evaled = FALSE, ...)
noGraphicsRaw(val, graphics, env, evaled = FALSE, ...)
evaluate_ef(code, env, evaled = FALSE, last = FALSE, stop_on_error = 1,
...)
evaluate_rh(val, graphics, env, evaled = FALSE, ...)
|
code |
The code to evaluate |
env |
The evaluation environment/environment the return handler should populate |
... |
Generally unused. |
val |
ANY. The object returned from the evaluation function |
graphics |
PlotList. The graphics captured during evaluation |
evaled |
Logical. Indicates whether evaluation occured (it is passed
|
last |
Logical. Is the value being processed the output of the final expression in the code being handled. |
stop_on_error |
integer. Passed to evaluate. |
Evaluation functions must accept code
, env
, and ...
.
Return value handlers must accept val
, graphics
,
env
, and ...
. They will also be passed evaled
and last
when called by the caching machinery, and can
handle those specifically or catch them in ...
.
parseEval
simply parses and evaluates the code, returning the
value returned by the call to eval
.
parseWithVis
evaluates the code using withVis
and
returns a WithVisValue
object with the resulting return
value and visibility information.
withVisHandler
accepts the WithVisValue
object
returned by parseWithVis
as well as printing the final
result if the val$visible
is TRUE
. It also draws any
plots stored in the cache in the case that evaled
is
FALSE
(if it were TRUE
those plots would have
already been generated during the evaluation). Appropriate for use
with parseWithVis
.
returnRaw
recreates any plots recorded in the cache (always,
not differentiating between evaluation and cache loading) and
returns val
unmodified. Appropriate for use with parseEval
noGraphicsRaw
returns val
unmodified without
recreating any plots.
Evaluation functions should return the result of evaluating
the code, along with information sufficient to recreate any
non-plotting side-effects the user wishes to record and
recreate on loading from cache. Return value handlers should
recreate those side effects, and can then call returnRaw
or withVisRaw
to recreate plots and return the value
from a raw return val
or WithVisValue
val object,
respectively. WithVisValue
objects are created
automatically by the default evaluate function.
Gabriel Becker
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.