devEval
From R.utils v1.9.6
by Henrik Bengtsson
Opens a new device, evaluate (graphing) code, and closes device
Opens a new device, evaluate (graphing) code, and closes device.
Usage
devEval(type=getOption("device"), expr, envir=parent.frame(), name="Rplot", tags=NULL, ..., ext=substitute(type), filename=sprintf("%s.%s", paste(c(name, tags), collapse = ","), ext), path=getOption("devEval/args/path", "figures/"), field=NULL, force=getOption("devEval/args/force", TRUE))
Arguments
- type
- Specifies the type of device to be used by
devNew
. - expr
- The
expression
of graphing commands to be evaluated. - envir
- The
environment
whereexpr
should be evaluated. - name, tags
- The fullname name of the image is specified as the name with optional comma-separated tags appended.
- ext
- The filename extension of the image file generated, if any.
By default, it is inferred from argument
type
. - ...
- Additional arguments passed to
devNew
. - filename
- The filename of the image saved, if any. See also below.
- path
- The directory where then image should be saved, if any.
- field
- An optional
character
string specifying a specific field of the named resultlist
to be returned. - force
- If
TRUE
, and the image file already exists, then it is overwritten, otherwise not.
Value
- Returns a named
list
with items specifying for instance the pathname, the fullname etc of the generated image. If argumentfield
is given, then the value of the corresponding element is returned. Note that the return value may be changed in future releases.
Generated image file
If created, the generated image file is saved in the directory
specfied by argument path
with a filename consisting of
the name
followed by optional comma-separated tags
and a filename extension given by argument ext
.
See Also
devNew
().
Examples
res <- devEval("png", name="MyPlot", tags=c("10", "rnd"), aspectRatio=0.7, {
plot(1:10)
})
print(res$pathname)
# [1] "figures/MyPlot,10,rnd.png"
res <- devEval("pdf", name="MyPlot", tags=c("10", "rnd"), aspectRatio=0.7, {
plot(1:10)
})
print(res$pathname)
# [1] "figures/MyPlot,10,rnd.pdf"
res <- devEval("eps", name="MyPlot", tags=c("10", "rnd"), aspectRatio=0.7, {
plot(1:10)
})
print(res$pathname)
# [1] "figures/MyPlot,10,rnd.eps"
Community examples
Looks like there are no examples yet.