View source: R/matrix.to.phyloframe.R
matrix.to.phyloframe | R Documentation |
Converts matrix to phyloframe
matrix.to.phyloframe(Mat, MetaData = NULL, data.name = "Data",
empty.val = NA)
Mat |
Matrix. Rownames must be species |
MetaData |
data.table or data.frame of meta-data to include in phyloframe |
data.name |
Character. Name of data from |
empty.val |
Values of |
library(phylofactor)
set.seed(1)
m=3 #number of species
n=5 #number of samples
d=10 #number of data points
DF <- data.frame('Species'=sample(letters[1:m],d,replace=TRUE),
'Sample'=sample(1:n,d,replace=TRUE),
'Abundance'=rpois(d,4))
Mat <- phyloframe.to.matrix(DF,mat.data='Abundance',empty.val=NA)
DF2 <- matrix.to.phyloframe(Mat,data.name='Abundance')
MetaData <- data.frame('Sample'=as.character(1:n),'x'=2*(1:n),'y'=-(1:n))
matrix.to.phyloframe(Mat,MetaData,data.name='Abundance')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.