rowid_matrix_to_df: Matrix to Dataframe with Row ID Preservation

View source: R/rowid_matrix_to_df.R

rowid_matrix_to_dfR Documentation

Matrix to Dataframe with Row ID Preservation

Description

Similar to tibble::rowid_to_column but also converting matrix to dataframe. It can also take lists of matrix/dataframes.

Usage

rowid_matrix_to_df(x, colname = "rownames")

Arguments

x

The object(s) with row IDs to be converted to dataframes

colname

The column name that will contain the row names

Examples

mdat <- matrix(c(1, 2, "A", "B"), nrow = 2, ncol = 2, byrow = TRUE,
               dimnames = list(c("row1", "row2"), c("col1", "col2")))
rowid_matrix_to_df(mdat, colname = "row")


sysilviakim/Kmisc documentation built on Jan. 28, 2023, 10:58 a.m.