| latticistCompose {latticist} | R Documentation |
Convert a simple specification list into a Lattice plot call, or the inverse operation.
latticistCompose(dat, spec = list(),
datArg = substitute(dat),
enclos = parent.frame())
dat |
a data frame (with numeric and/or categorical variables). |
spec |
a list specifying the latticist plot. See Details. |
datArg |
the symbol to use for dat in the generated call.
|
enclos |
an environment to use as an enclosure around dat for
evaluating expressions.
|
Elements of spec can include:
xvar, yvar, zvardefaultPlot (see below).
Note that x or y may be discretized by setting doXDisc or
doYDisc (see below).
groupscond, cond2nLevels distinct levels (see below).
subsetvarSubsetdefaultPlotxvar and yvar are
missing. Note that groups is supported by all these plots,
and cond is supported by "splom" and "parallel".
NOTE: when the data is a table, "parallel" does
not produce a parallel plot, but rather a stacked
barchart of the table.
Also when the data is a table, "splom" produces a
pairs layout of mosaic plots.
aspectdoLinesdotplot and cloud this refers to droplines (type
"h") (though if groups are defined in a dotplot, type
"l" is used).
In a grouped stripplot, group medians are joined (type
"a", fun = median).
For qqmath the points are joined in order (type "l").
For xyplot and similar, the line type depends on the nature
of the data; if the data x values form a regular sequence or are
few in number they are simply joined (type "l");
if duplicate x values are detected, with a reasonable number of
unique values, their averages are joined (type "a");
otherwise a smoothing line is added according to
latticist.getOption("xyLineType"). This defaults to
"smooth" (loess fit), but could reasonably be set to
"r" (regression line) or "a" (joined averages).
doHexbinhexbinplot rather than xyplot for
bivariate numeric plots. These can be faster and more effective
for large datasets. Note that groups are not supported.
doSegments, doAsErrordoSegments is TRUE when all of xvar, yvar
and zvar are defined, a segplot is produced where
the x values are joined to z values by horizontal
segments. Alternatively, if doAsError is TRUE, segments are
drawn from (x - z) to (x + z), and each x point is
marked, such that z acts as an error or range about x.
doTilexvar, yvar and groups are all
numeric), this option will draw a tileplot, which draws a
polygon enclosing each point. This may be appropriate when x and y
are on the same scale.
doXDisc, doYDiscxvar and/or yvar, if they are
numeric. Either cut or equal.count is used,
depending on the plot type, with nLevels distinct levels.
nLevelscond and cond2,
optionally xvar or yvar, and in some cases
groups. For shingles, the amount of overlap is taken from
latticist.getOption("shingle.overlap").
x.relation, y.relationdoSeparateStratamosaic plot is produced and cond or
cond2 are defined, this defines whether to separate the
strata defined by conditioning variables into different panels
(the default; uses cotabplot), or to include the
conditioning variables in the one mosaic plot
(doSeparateStata = FALSE).
Note that xvar, yvar, zvar, groups, cond, cond2, subset must be
character strings (or NULL), and will be parsed.
latticistCompose returns a call.
Felix Andrews felix@nfrac.org
For an excellent introduction to and coverage of Lattice:
Sarkar, Deepayan (2008) "Lattice: Multivariate Data Visualization with R", Springer. http://lmdvr.r-forge.r-project.org/
latticistCompose(CO2) latticistCompose(CO2, spec = list(defaultPlot = "parallel")) latticistCompose(CO2, spec = list(xvar = "uptake")) latticistCompose(CO2, spec = list(yvar = "uptake")) latticistCompose(CO2, spec = list(yvar = "uptake", doYDisc = TRUE))