get_alphaindex {MicrobiotaProcess} | R Documentation |
calculate the alpha index (Obseve,Chao1,Shannon,Simpson) of sample
with diversity
get_alphaindex(obj, ...) ## S4 method for signature 'matrix' get_alphaindex(obj, mindepth, sampleda, ...) ## S4 method for signature 'data.frame' get_alphaindex(obj, ...) ## S4 method for signature 'integer' get_alphaindex(obj, ...) ## S4 method for signature 'numeric' get_alphaindex(obj, ...) ## S4 method for signature 'phyloseq' get_alphaindex(obj, ...)
obj |
object, data.frame of (nrow sample * ncol taxonomy(feature)) or phyloseq. |
... |
additional arguments. |
mindepth |
numeric, Subsample size for rarefying community. |
sampleda |
data.frame,sample information, row sample * column factors. |
data.frame contained alpha Index.
Shuangbin Xu
library(tidyverse) otudafile <- system.file("extdata", "otu_tax_table.txt", package="MicrobiotaProcess") otuda <- read.table(otudafile, sep="\t", header=TRUE, row.names=1, check.names=FALSE, skip=1, comment.char="") otuda <- otuda[sapply(otuda, is.numeric)] %>% t() %>% data.frame(check.names=FALSE) set.seed(1024) alphatab <- get_alphaindex(otuda) head(as.data.frame(alphatab)) data(test_otu_data) class(test_otu_data) set.seed(1024) alphatab2 <- get_alphaindex(test_otu_data) head(as.data.frame(alphatab2))