evalsOptions: Querying/setting evals option

View source: R/options.R

evalsOptionsR Documentation

Querying/setting evals option

Description

To list all 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.

Usage

evalsOptions(o, value)

Arguments

o

option name (string). See below.

value

value to assign (optional)

Details

The following evals options are available:

  • parse: if TRUE the provided txt 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 a plot and on next line adding an abline or text to it), use a plus char (+) at the beginning of each line which should be evaluated with the previous one(s). If set to FALSE, evals would not try to parse R code, it would get evaluated in separate runs - as provided. Please see examples of evals.

  • cache: caching the result of R calls if set to TRUE

  • cache.mode: cached results could be stored in an environment in current R session or let it be permanent on disk.

  • cache.dir: path to a directory holding cache files if cache.mode set to disk. Default to .cache in current working directory.

  • cache.time: number of seconds to limit caching based on proc.time. If set to 0, all R commands, if set to Inf, none is cached (despite the cache parameter).

  • cache.copy.images: copy images to new files if an image is returned from cache? If set to FALSE (default) the "old" path would be returned.

  • classes: a vector or list of classes which should be returned. If set to NULL (by default) all R objects will be returned.

  • hooks: list of hooks to be run for given classes in the form of list(class = fn). If you would also specify some parameters of the function, a list should be provided in the form of list(fn, param1, param2=NULL) etc. So the hooks would become list(class1=list(fn, param1, param2=NULL), ...). See examples of evals. 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 the result, and do not want to save/see e.g. messages or printed output. See examples of evals.

  • graph.unify: boolean (default: FALSE) that determines if evals should try to unify the style of (base, lattice and ggplot2) plots? If set to TRUE, some panderOptions() would apply.

  • graph.name: set the file name of saved plots which is tempfile by default. A simple character string might be provided where %d would be replaced by the index of the generating txt source, %n with an incremented integer in graph.dir with similar file names and %t by some random characters. A function's name to be evaluated 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 to plots in current working directory.

  • graph.output: set the required file format of saved plots. Currently it could be any of grDevices: png, bmp, jpeg, jpg, tiff, svg or pdf. Set to NA not to save plots at all and tweak that setting with capture.plot() on demand.

  • width: width of generated plot in pixels for even vector formats

  • height: height of generated plot in pixels for even vector formats

  • res: nominal resolution in ppi. The height and width of vector images will be calculated based in this.

  • hi.res: generate high resolution plots also? If set to TRUE, 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. The height and res 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 on graph.name) with env extension?

  • graph.recordplot: save the plot via recordPlot to distinct files (based on graph.name) with recodplot extension?

  • graph.RDS: save the raw R object returned (usually with lattice or ggplot2) while generating the plots to distinct files (based on graph.name) with RDS extension?

  • log: NULL or an optionally passed namespace from logger to record all info, trace, debug and error messages.

See Also

evals panderOptions

Examples

evalsOptions()
evalsOptions('cache')
evalsOptions('cache', FALSE)

Rapporter/pander documentation built on Sept. 15, 2024, 2:11 p.m.