Description Usage Arguments Details Value Note Author(s) Examples
View source: R/matrix2longdf.R
The function converts a matrix into a long-format, three-column data.frame, containing row, columna nd value. Such ‘long’ data.frames can be useful in data visualization and modelling.
1 2 3 4 5 6 | matrix2longdf(
mat,
row.names,
col.names,
longdf.colnames = c("row", "column", "value")
)
|
mat |
A matrix |
row.names |
Character, row names to appear in the |
col.names |
Charater, column names to appear in the |
longdf.colnames |
Character, column names of the output long data frame |
The function converts a matrix into a three-column, ‘long’ format data.frame containing row names, column names, and values of the matrix.
A data.frame
object with three columns: row
,
column
and value
. If the input matrix is of dimesion
MxN
, the returning data.frame
is of the dimension MNx3
.
The length of row.names
and col.names
should be as the
same as the matrix dimension. Otherwise the function raises warnings.
Jitao David Zhang <jitao_david.zhang@roche.com>
1 2 3 4 5 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.