Creates a base-R pairs plot with correlations in the lower triangle,
optional histograms on the diagonal, and optional smoothers in the upper
triangle.
correlation_matrix(
data,
variables,
hist = TRUE,
smooth = TRUE,
size = 1,
color = "darkgrey"
)
Arguments
- data
A data frame containing the variables.
- variables
Character vector naming the variables to plot. Character
columns are not supported.
- hist
Show histograms on the diagonal.
- smooth
Show LOWESS smoothers in the upper triangle.
- size
Point expansion factor.
- color
Point and smoother colour.
Value
Invisibly returns the data frame used for plotting.
Examples
data("data_s")
correlation_matrix(data_s, c("typeOfS", "sDur"))