Description Usage Arguments Details Value Warning See Also Examples
Produce plots from R expression(s), function(s), or file(s) in specified file formats. An XML file is also created which contains information about the plots produced.
1 2 3 4 5 6 7 8 |
expr |
character vector of R expressions which may or may not produce graphical output. |
filename |
the name of the file which the expressions are to be read from. The path is assumed to be relative to the current working directory unless an absolute path is given. |
fun |
character vector naming the function(s) to plot or just the (named) function. |
filetype |
character vector specifying file formats to produce the plots in (see details for currently supported formats). |
path |
character vector; path to produce output in. If not given, the current working directory will be used. |
prefix |
character vector; prefix for files produced. If multiple functions or files are given, the resulting plotFile or plotFunction XML file will use the first prefix. |
clear |
logical (not NA); remove files with names we might use
first. If |
All functions evaluate the code they are given, capturing and recording any
warnings and errors. The code run for plotFunction is extracted from
any example code (see example
).
If an error is encountered when running a block of code, that particular block (say, a file or function) will stop being executed for that filetype but the error will be recorded. If a warning is encountered, the code will continue being evaluated.
The name for the log file is based on the first prefix and the type of
function producing the plots. For plotExpr
XML logs, 1 log file
will be produced with a name of the form ‘prefix-log.xml’.
plotFile
and plotFunction
work by making multiple calls
to plotExpr
, so will produce plotExpr
logs (one for each
file or function respectively), as well as their own log, which will
be named (using the first prefix) with the format ‘prefix-fileLog.xml’
and ‘prefix-funLog.xml’ respectively.
Currently supported file formats are ‘pdf’, ‘png’, and
‘ps’ (and ‘bmp’ on Windows). If the filetype
argument is NULL
, all valid file formats are produced.
A list of class qcPlotExprResult
, qcPlotFileResult
, or
qcPlotFunctionResult
respectively. The list contains
information about the environment creating the plots (Operating
System, R version, date, call), the names of the plots produced and
any warnings/errors produced.
Do not give any code that will open a graphics device (especially if that device is not closed).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ## Not run:
# plotExpr example:
example1 <- plotExpr(c("plot(1:10)", "plot(4:40)", "x<-3", "plot(2:23)"),
c("pdf", "ps"), "example1", "myPrefix")
# There should now be a folder "example1" in the current
# working directory containing pdf and ps files and myPrefix-log.xml, ie
list.files("example1")
# plotFunction example:
example2 <- plotFunction(c("plot", "barplot", "hist"), c("pdf", "ps"),
path = "example2")
list.files("example2")
# A bigger example:
# require(grid)
# gridExample <- plotFunction(ls("package:grid"), c("pdf", "png", "ps"),
# path = "gridExample")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.