phyloframe.to.matrix: Converts input data frame for gpf to matrix for faster...

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

phyloframe.to.matrixR Documentation

Converts input data frame for gpf to matrix for faster indexing

Description

Converts input data frame for gpf to matrix for faster indexing

Usage

phyloframe.to.matrix(DF, mat.data = "N", empty.val = 0)

Arguments

DF

data frame containing, at the minimum, columns "Species", "Sample", and the column with character string defined in mat.data. If DF does not contain "Sample", a vector will be output.

mat.data

Character string. Column of DF input to the matrix

empty.val

Value for empty Species x Sample pairs. Default is 0.

Examples

library(phylofactor)
m=10   #number of species
n=15   #number of samples
d=100  #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,2))
M <- phyloframe.to.matrix(DF,mat.data='Abundance',empty.val=0)


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