matrix.to.phyloframe: Converts matrix to phyloframe

View source: R/matrix.to.phyloframe.R

matrix.to.phyloframeR Documentation

Converts matrix to phyloframe

Description

Converts matrix to phyloframe

Usage

matrix.to.phyloframe(Mat, MetaData = NULL, data.name = "Data",
  empty.val = NA)

Arguments

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 Mat for phyloframe

empty.val

Values of Mat to ignore and not include in phyloframe

Examples

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')

reptalex/phylofactor documentation built on Feb. 28, 2024, 3:19 p.m.