evals
options, just run this function
without any parameters provided. To query only one value,
pass the first parameter. To set that, use the
value
parameter too.evalsOptions(o, value)
evals
options are available:
parse
: ifTRUE
the providedtxt
elements would be merged into one string and
parsed to logical chunks. This is useful if you would
want to get separate results of your code parts - not
just the last returned value, but you are passing the
whole script in one string. To manually lock lines to
each other (e.g. calling aplot
and on next line
adding anabline
ortext
to it), use a plus
char (+
) at the beginning of each line which
should be evaluated with the previous one(s). If set toFALSE
,evals
would not try to parse R code,
it would get evaluated in separate runs - as provided.
Please see examples ofevals
.cache
: caching the result of R calls if set toTRUE
cache.mode
: cached results could
be stored in anenvironment
incurrentR
session or let it be permanent ondisk
.cache.dir
: path to a directory holding cache files
ifcache.mode
set todisk
. Default to.cache
in current working directory.cache.time
: number of seconds to limit caching
based onproc.time
. If set to0
, all R
commands, if set toInf
, none is cached (despite
thecache
parameter).cache.copy.images
: copy images to new files if an
image is returned from cache? If set toFALSE
(default) the "old" path would be returned.classes
: a vector or list of classes which should
be returned. If set toNULL
(by default) all R
objects will be returned.hooks
: list of
hooks to be run for given classes in the form oflist(class = fn)
. If you would also specify some
parameters of the function, a list should be provided in
the form oflist(fn, param1, param2=NULL)
etc. So
the hooks would becomelist(class1=list(fn, param1,
param2=NULL), ...)
. See examples ofevals
.
A default hook can be specified too by setting the class
to'default'
. This can be handy if you do not want
to define separate methods/functions to each possible
class, but automatically apply the default hook to all
classes not mentioned in the list. You may also specify
only one element in the list like:hooks=list('default' = pander.return)
. Please
note, that nor error/warning messages, nor stdout is
captured (so: updated) while running hooks!length
: any R object exceeding the specified
length will not be returned. The default value
(Inf
) does not filter out any R objects.output
: a character vector of required returned
values. This might be useful if you are only interested
in theresult
, and do not want to save/see e.g.messages
orprint
edoutput
. See
examples ofevals
.graph.unify
: shouldevals
try to unify the
style of (base
,lattice
andggplot2
)
plots? If set toTRUE
, somepanderOptions()
would apply. By default this is disabled not to freak out
useRs :)graph.name
: set the file name of
saved plots which istempfile
by default. A
simple character string might be provided where%d
would be replaced by the index of the
generatingtxt
source,%n
with an
incremented integer ingraph.dir
with similar file
names and%t
by some random characters. A
function's name to beeval
uated can be passed here
too.graph.dir
: path to a directory where
to place generated images. If the directory does not
exist,evals
try to create that. Default
set toplots
in current working directory.graph.output
: set the required file format of
saved plots. Currently it could be any ofgrDevices
:png
,bmp
,jpeg
,jpg
,tiff
,svg
orpdf
.width
: width of generated plot in pixels for even
vector formatsheight
: height of generated
plot in pixels for even vector formatsres
:
nominal resolution inppi
. The height and width of
vector images will be calculated based in this.hi.res
: generate high resolution plots also? If
set toTRUE
, each R code parts resulting an image
would be run twice.hi.res.width
: width of
generated high resolution plot in pixels for even vector
formats. Theheight
andres
of high
resolution image is automatically computed based on the
above options to preserve original plot aspect ratio.graph.env
: save the environments in which
plots were generated to distinct files (based ongraph.name
) withenv
extension?graph.recordplot
: save the plot viarecordPlot
to distinct files (based ongraph.name
) withrecodplot
extension?graph.RDS
: save the raw R object returned
(usually withlattice
orggplot2
) while
generating the plots to distinct files (based ongraph.name
) withRDS
extension?evals
panderOptions
evalsOptions()
evalsOptions('cache')
evalsOptions('cache', FALSE)
Run the code above in your browser using DataLab