matrix2long {corrViz}R Documentation

matrix2long

Description

Convert a Matrix to Long Format.

Usage

matrix2long(mat)

Arguments

mat

A matrix to be converted into long format.

Details

This function converts a matrix into a long format data frame. The resulting data frame contains four columns: row, column, value, and id. The 'id' column assigns a unique identifier to each column group, making it easier to identify and analyze the data by column groups.

Value

A data frame in long format with columns: row, column, value, and id.

Examples

# Create a matrix
mat <- matrix(data = 1:9,
              nrow = 3,
              ncol = 3,
              dimnames = list(c("A", "B", "C"),
                              c("X", "Y", "Z")))

long_format <- matrix2long(mat)
long_format

# Using correlation matrix
matrix2long(cor(mtcars))


[Package corrViz version 0.1.0 Index]