Learn R Programming

latticeExtra (version 0.5-1)

marginals: Display marginal distributions

Description

Display marginal distributions of several variables, which may be numeric and/or categorical, on one plot.

Usage

marginals(data,
          reorder = TRUE,
          plot.points = FALSE,
          ref = TRUE,
          origin = 0,
          levels.fos = NULL,
          xlab = NULL, ylab = NULL,
          cex = 0.5,
          ...,
          subset = TRUE,
          as.table = TRUE,
          subscripts = TRUE,
          default.scales = list(
            x = list(relation="free", abbreviate=TRUE,
                     rot=60, cex=0.5, tick.number=3),
            y = list(relation="free", draw=FALSE)))

Arguments

data
a data frame.
reorder
whether to reorder factor variables by frequency.
subset
data subset expression, evaluated with data.
plot.points, ref
passed to panel.densityplot.
origin, levels.fos
passed to panel.dotplot.
xlab, ylab, cex, as.table, subscripts, default.scales
see xyplot.

Value

  • a trellis object.

Details

In the case of mixed numeric and categorical variables, the trellis objects from dotplot() and densityplot are merged.

See Also

panel.dotplot, panel.densityplot

Examples

Run this code
enviro <- environmental
## make an ordered factor (so it will not be reordered)
enviro$smell <- cut(enviro$ozone, breaks=c(0,30,50,Inf),
    labels=c("ok","hmmm","yuck"), ordered=TRUE)
marginals(enviro)

Run the code above in your browser using DataLab