RGraph | R Documentation |
Provides for generating graphics by passing an expression to open-source R and evaluating it there.
RGraph(expr, substitute = TRUE, width = deviceArgs[["width"]], height = deviceArgs[["height"]], data = NULL, envirData = parent.frame(), graphicsDevice = "png", deviceArgs = list(), packages = getOption("RGraphPackages"), verbose = FALSE, display = FALSE, file = NULL, returnFilename = FALSE, viewer = if(graphicsDevice == "win.metafile") browseURL else getOption("viewer", default=browseURL), REvaluator. = RinR::REvaluator)
expr |
an expression that produces the desired graphic. |
substitute |
a logical value. If |
width |
an integer giving the width of the graphic to create. The units depend
on the |
height |
an integer giving the height of the graphic to be created. The units depend
on the |
data |
if not |
envirData |
an environment. If the |
graphicsDevice |
a character string specifing the R function that produces the desired graphics
file format: |
deviceArgs |
a list with names listing the arguments to pass to the |
packages |
a character vector identifying any packages that must be loaded before
|
verbose |
a logical value. If |
display |
a logical value. If |
file |
a character string naming the graphics file. If |
returnFilename |
a logical value. If |
viewer |
a function that takes a name of a graphics file for an argument and displays the graphics in the file.
The function |
REvaluator. |
an |
Some functions (like those in "package:lattice"
and "package:ggplot2"
)
must be wrapped inside a print()
statement to display the graphic.
This function creates an expression that is passed to REvaluate
. If you want to
create some graphics and return non-graphical results in one call to REvaluate
you must call REvaluate
directly.
RGraph
uses the all.vars
function, along with some heuristics,
to search the expression expr
for names of objects
that do not look like functions. This behavior can cause some surprises.
If your expr
involves functions with nonstandard argument evaluation, like ~
, with
,
or subset
, RGraph
may try to send objects that do not exist in the caller's environment.
If your code involves a function as an argument, the function is sent to the remote
R evaluator and it might not work there (for example, a built-in \TERR function such as
na.omit
does not work in open-source R).
If returnFilename
is FALSE
,
returns, invisibly, a raw
vector containing the bytes in the graphics file.
Otherwise, returns the name of the graphics file.
REvaluate
## Not run: library(Sdatasets) ### basic plot RGraph(hist(fuel.frame$Disp.), data = "fuel.frame", display = TRUE) ### basic plot, sending data under a new name RGraph(hist(ff$Disp.), data=list(ff = Sdatasets::fuel.frame), display = TRUE) ### image in jpeg format, let Rgraph figure out which dataset needs to be sent grFile <- RGraph(image(voice.five), graphicsDevice="jpeg", deviceArgs=list(pointsize=20), display=TRUE, returnFile = TRUE) unlink(grFile) # clean up when done looking at the file ### use lattice package (so must use print() to make the plot). ### Since xyplot() includes data argument, RGraph does not try ### to send over the vectors named in its formula argument. RGraph(print(xyplot(Fuel ~ Weight | Type, data=fuel.frame)), packages="lattice", display = TRUE) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.