spm is an abbreviation for scatterplotMatrix.
  This function just sets up a call to pairs with custom panel functions.scatterplotMatrix(x, ...)
## S3 method for class 'formula':
scatterplotMatrix(formula, data=NULL, subset, labels, ...)
## S3 method for class 'default':
scatterplotMatrix(x, var.labels=colnames(x), 
    diagonal=c("density", "boxplot", "histogram", "oned", "qqplot", "none"), 
    adjust=1, nclass,
    plot.points=TRUE, smoother=loessLine, smoother.args=list(), smooth, span,
    spread = !by.groups, reg.line=lm,
    transform=FALSE, family=c("bcPower", "yjPower"),
    ellipse=FALSE, levels=c(.5, .95), robust=TRUE,
    groups=NULL, by.groups=FALSE, 
    use=c("complete.obs", "pairwise.complete.obs"),
    labels, id.method="mahal", id.n=0, id.cex=1, id.col=palette()[1],
    col=if (n.groups == 1) palette()[3:1] else rep(palette(), length=n.groups),
    pch=1:n.groups, lwd=1, lty=1, 
    cex=par("cex"), cex.axis=par("cex.axis"), cex.labels=NULL, 
    cex.main=par("cex.main"), 
    legend.plot=length(levels(groups)) > 1, legend.pos=NULL, row1attop=TRUE, ...)
spm(x, ...)~ x1 + x2 + ... + xk or ~ x1 + x2 + ... + xk | z where z
    evaluates to a factor or other variable to divide the data into groups.scatterplotMatrix.formula,
    a data frame within which to evaluate the formula.id.n=0 for labeling no points.  See
    showLabels for details of these arguments.  If the plot uses
    different colors for gr"histogram") will be drawn for each group.density function.hist
    function.TRUE the points are plotted in each 
    off-diagonal panel.ScatterplotSmoothers).smooth=TRUE then smoother is set to loessLine,
  and if span is specified, it is added to smoother.args.loessLine and
    for gamLine, this is done by separately smoothing the squares of the postive and negative
    residuals from the mean fit, and then adding theFALSE a line is plotted using the
    function given by this argument; e.g., using rlm in
    package MASS plots a robust-regression line.TRUE, multivariate normalizing power transformations
    are computed with powerTransform, rounding the estimated powers to `nice' values for plotting; 
    if a vector of powers, o"bcPower" for the Box-Cox family or 
    "yjPower" for the Yeo-Johnson family (see powerTransform).TRUE data-concentration ellipses are plotted in
    the off-diagonal panels.c(.5, .9).TRUE use the cov.trob function in the MASS package
    to calculate the center and covariance matrix for the data ellipses.TRUE, regression lines are fit by groups."complete.obs" (the default), cases with missing data are omitted; if "pairwise.complete.obs"), all valid cases are used
    in each panel of the plot.par).palette()[3] for linear regression lines, palette()[2] for nonparametric regression lines, and palette()[1] 
  	for points if there1).1, solid line).par).TRUE then a legend for the groups is plotted
    in the first diagonal cell.legend. If NULL, the default, the position will vary by the 
    diagonal argument --- e.g., "topriTRUE (the default) the first row is at the top, as in a matrix, as
  	opposed to at the bottom, as in graph (argument suggested by Richard Heiberger).NULL. This function is used for its side effect: producing
  a plot.pairs, scatterplot,
  dataEllipse, powerTransform, 
  bcPower, yjPower, cov.trob,
  showLabels, ScatterplotSmoothers.scatterplotMatrix(~ income + education + prestige | type, data=Duncan)
scatterplotMatrix(~ income + education + prestige, 
    transform=TRUE, data=Duncan, smoother=loessLine)
scatterplotMatrix(~ income + education + prestige | type, smoother=FALSE, 
	by.group=TRUE, transform=TRUE, data=Duncan)Run the code above in your browser using DataLab