mat2df: mat2df

View source: R/matrix-utils.R

mat2dfR Documentation

mat2df

Description

convert a matrix to a tidy data frame (from wide to long format as described in the tidyverse concept)

Usage

mat2df(x)

Arguments

x

the input matrix

Value

a data.frame in long format with the 'value' column stores the original values and 'row' and 'col' columns stored in row and column index as in x

Author(s)

Guangchuang Yu

Examples

x <- matrix(1:15, nrow = 3)
mat2df(x)

yulab.utils documentation built on Sept. 20, 2023, 9:06 a.m.