callArg: Work with plot call arguments

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/apiMain.R

Description

Part of the playwith Application Programming Interface.

Usage

1
2
3
4
5
6
7

Arguments

playState

a playState object representing the plot, window and device.

arg

the argument name or number in the main plot call. This can also be a language object (e.g. quote(scales$log)). Argument numbers start from 1 (so 0 refers to the main function name). This is evaluated in the calling environment, so can refer to local variables (e.g. data[[myname]]).

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.

Details

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:

Value

returns the value of the specified argument, possibly evaluated in a local environment (playState$env).

Author(s)

Felix Andrews [email protected]

See Also

playwith.API

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
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)

}

playwith documentation built on May 29, 2017, 12:28 p.m.