Learn R Programming

s20x (version 3.3.0)

pairs20x: Pairwise Scatter Plots with Histograms and Correlations

Description

Plots pairwise scatter plots with histograms and correlations for the data frame.

Usage

pairs20x(x, na.rm = TRUE, engine = c("base", "ggplot2"), ...)

Value

Returns the plot.

Arguments

x

a data frame.

na.rm

if TRUE then only complete cases will be displayed.

engine

plotting engine to use. The default, "base", preserves the original base graphics output. Use "ggplot2" for the optional ggplot2/GGally output.

...

optional arguments passed to the underlying plotting function.

Details

The default base graphics engine preserves the original s20x teaching plot and draws directly on the active graphics device. The optional ggplot2 engine uses GGally when both optional packages are installed and returns a reusable plot matrix for reports or further customisation. The ggplot2/GGally output is intentionally optional so existing teaching material can continue to rely on the base graphics default.

See Also

'pairs', 'panel.smooth', 'panel.cor', 'panel.hist'

Examples

Run this code

## Peruvian Indians
data(peru.df)
pairs20x(peru.df)

# Optional ggplot2/GGally engine for a reusable plot matrix
if (requireNamespace("ggplot2", quietly = TRUE) &&
    requireNamespace("GGally", quietly = TRUE)) {
  pairsPlot = pairs20x(peru.df, engine = "ggplot2")
  class(pairsPlot)
}

Run the code above in your browser using DataLab