mp_anosim-methods: Analysis of Similarities (ANOSIM) with MPSE or tbl_mpse...

mp_anosimR Documentation

Analysis of Similarities (ANOSIM) with MPSE or tbl_mpse object

Description

Analysis of Similarities (ANOSIM) with MPSE or tbl_mpse object

Usage

mp_anosim(
  .data,
  .abundance,
  .group,
  distmethod = "bray",
  action = "add",
  permutations = 999,
  seed = 123,
  ...
)

## S4 method for signature 'MPSE'
mp_anosim(
  .data,
  .abundance,
  .group,
  distmethod = "bray",
  action = "add",
  permutations = 999,
  seed = 123,
  ...
)

## S4 method for signature 'tbl_mpse'
mp_anosim(
  .data,
  .abundance,
  .group,
  distmethod = "bray",
  action = "add",
  permutations = 999,
  seed = 123,
  ...
)

## S4 method for signature 'grouped_df_mpse'
mp_anosim(
  .data,
  .abundance,
  .group,
  distmethod = "bray",
  action = "add",
  permutations = 999,
  seed = 123,
  ...
)

Arguments

.data

MPSE or tbl_mpse object

.abundance

the name of abundance to be calculated.

.group

The name of the column of the sample group information.

distmethod

character the method to calculate pairwise distances, default is 'bray'.

action

character "add" joins the ANOSIM result to internal attribute of the object, "only" and "get" return 'anosim' object can be analyzed using the related vegan funtion.

permutations

the number of permutations required, default is 999.

seed

a random seed to make the ANOSIM analysis reproducible, default is 123.

...

additional parameters see also 'anosim' of vegan.

Value

update object according action argument

Author(s)

Shuangbin Xu

Examples

data(mouse.time.mpse)
mouse.time.mpse %<>%
  mp_decostand(.abundance=Abundance)
# action = "get" will return a anosim object
mouse.time.mpse %>% 
  mp_anosim(.abundance=hellinger, .group=time, action="get")
# action = "only" will return a tbl_df that can be as the input of ggplot2.
library(ggplot2)
tbl <- mouse.time.mpse %>% 
       mp_anosim(.abundance=hellinger, 
                 .group=time,
                 permutations=999, # for more robust, set it to 9999
                 action="only")
tbl
tbl %>%
ggplot(aes(x=class, y=rank, fill=class)) + 
geom_boxplot(notch=TRUE, varwidth = TRUE)

xiangpin/MicrobiotaProcess documentation built on April 14, 2024, 10:10 a.m.