cor_lower: Return the upper or lower triangular part

View source: R/cor_lower.R

cor_lowerR Documentation

Return the upper or lower triangular part

Description

Return the upper or lower triangular part of the correlation matrix.

Usage

cor_lower(x, diag = FALSE, ...)

Arguments

x

A correlation object.

diag

Should the diagonal be included?

...

Other arguments to be passed to or from other functions.

Examples

x <- correlation(mtcars, redundant = TRUE) # Generate full matrix
x <- cor_lower(x)

if (require("ggplot2")) {
  ggplot(x, aes(x = Parameter2, y = Parameter1, fill = r)) +
    geom_tile()
}

# Sorted
x <- correlation(mtcars, redundant = TRUE) # Generate full matrix
x <- cor_sort(x)
x <- cor_lower(x)

if (require("ggplot2")) {
  ggplot(x, aes(x = Parameter2, y = Parameter1, fill = r)) +
    geom_tile()
}

correlation documentation built on April 6, 2023, 5:18 p.m.