View source: R/matrixConvert.R
matrixConvert | R Documentation |
This function will convert lower triangular distance matrix into a 3-column, long-format data frame.
matrixConvert(triMatrix, colname = c("sp1", "sp2", "dist"))
triMatrix |
Matrix, the input matrix should be lower triangular matrix. |
colname |
Character, a vector of length 3 to specify the column names of the converted data frame. |
This function will call the "melt" function in the reshape2 package, and convert the pairwise values in the lower triangular distance matrix into long-format data frame.
The function returns long format of data frame, with 3 columns. The first two columns give the pairwise names and the third column contains values in the matrix.
Sizhong Yang <yanglzu@163.com>
data(otuqiime)
mat <- calc_bc(t(otuqiime[,-ncol(otuqiime)]))
mat.m <- matrixConvert(mat, colname = c("sp1", "sp2", "bray"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.