get_alphaindex: alpha index

get_alphaindexR Documentation

alpha index

Description

calculate the alpha index (Obseve,Chao1,Shannon,Simpson) of sample with diversity

Usage

get_alphaindex(obj, ...)

## S4 method for signature 'matrix'
get_alphaindex(obj, mindepth, sampleda, force = FALSE, ...)

## 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, ...)

Arguments

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.

force

logical whether calculate the alpha index even the count of otu is not rarefied, default is FALSE. If it is TRUE, meaning the rarefaction is not be performed automatically.

Value

data.frame contained alpha Index.

Author(s)

Shuangbin Xu

Examples

## Not run: 
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)
test_otu_data %<>% as.phyloseq()
class(test_otu_data)
set.seed(1024)
alphatab2 <- get_alphaindex(test_otu_data)
head(as.data.frame(alphatab2))

## End(Not run)

YuLab-SMU/MicrobiotaProcess documentation built on Nov. 8, 2024, 4:37 p.m.