storeEval | R Documentation |
These functions are similar to source
but evaluate each top-level expression and
do something for each of these.
timeEval
times how long each expression took to complete.
storeEval
saves the result of each top-level as an intermediate result
that we can then compare as we change the code.
This helps us identify when and where changes
give different results.
seedChangeEval
checks whether the value of .Random.seed
changed during the evaluation of each top-level expression.
Again, this can help us debug changes to the code.
storeEval(code, envir = globalenv(), verbose = TRUE, store = new.env(), outVars = getOutputVariables(code), all = TRUE, ...)
code |
the R code, as a file name or the text or the parsed code |
envir |
the environment in which to evaluate each top-level expression. |
verbose |
a logical value controlling whether each expression is displayed before it is evaluated. |
store |
the environment object in which to store/assign the intermediate results. |
outVars |
the names of all the variables for which we want intermediate results |
all |
a logical value that controls whether we also add the final
versions of each variable to |
... |
ignore at present |
storeEval
returns the store
environment object containing the intermediate results.
timeEval
returns a list of the results from calling
system.time
when evaluating each top-level expression.
seedChangeEval
returns a list with the code for top-level
expressions grouped into sub-lists according to whether they were
evaluated with the same value for .Random.seed
.
Duncan Temple Lang
eval
new.env
f = system.file("sampleCode", "storeEvalEg.R", package = "CallCounter")
im = storeEval(f)
f = system.file("sampleCode", "timeEvalEg.R", package = "CallCounter")
tms = timeEval(f)
sapply(tms, `[`, 3)
f = system.file("sampleCode", "stochastic.R", package = "CallCounter")
iseed = seedChangeEval(f)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.