callArg {playwith} | R Documentation |
Part of the playwith Application Programming Interface.
callArg(playState, arg, eval = TRUE, data = NULL) callArg(playState, arg) <- value mainCall(playState) mainCall(playState) <- value updateMainCall(playState)
playState |
a |
arg |
the argument name or number in the main plot call.
This can also be a language object
(e.g. |
eval |
whether to evaluate the argument before returning it. Otherwise, just return the argument as it appears in the call. |
data |
a list or environment in which to evaluate the argument. Typically this will be the "data" argument to lattice or qplot functions. |
value |
the value to assign. |
These functions get and set argument values in the playState plot call.
As convenience functions for setting arguments in playState$call
,
the callArg
function helps by:
referring to the main call that accepts plot arguments, which is not necessarily the top-level call.
automatically evaluating variables that have been stored in a local environment
(playState$env
).
converting lists to language objects as needed.
enforcing exact matching of argument names exact=TRUE
(see [[
).
returns the value of the specified argument, possibly
evaluated in a local environment (playState$env
).
Felix Andrews felix@nfrac.org
if (interactive()) { library(lattice) playwith(xyplot(1:10 ~ 1:10)) playState <- playDevCur() callArg(playState, "pch") ## NULL callArg(playState, "pch") <- "$" callArg(playState, "pch") ## "$" playReplot(playState) ## referring to local variables tmp <- "x" callArg(playState, quote(scales[[tmp]]$cex)) <- 2 playReplot(playState) }