mp_cal_clust {MicrobiotaProcess} | R Documentation

## Hierarchical cluster analysis for the samples with MPSE or tbl_mpse object

### Description

Hierarchical cluster analysis for the samples with MPSE or tbl_mpse object

### Usage

    mp_cal_clust(
      .data,
      .abundance,
      distmethod = "bray",
      hclustmethod = "average",
      action = "get",
      ...
    )

    ## S4 method for signature 'MPSE'
    mp_cal_clust(
      .data,
      .abundance,
      distmethod = "bray",
      hclustmethod = "average",
      action = "get",
      ...
    )

    ## S4 method for signature 'tbl_mpse'
    mp_cal_clust(
      .data,
      .abundance,
      distmethod = "bray",
      hclustmethod = "average",
      action = "get",
      ...
    )

    ## S4 method for signature 'grouped_df_mpse'
    mp_cal_clust(
      .data,
      .abundance,
      distmethod = "bray",
      hclustmethod = "average",
      action = "get",
      ...
    )

### Arguments

`.data` | the MPSE or tbl_mpse object
`.abundance` | the name of abundance to be calculated.
`distmethod` | the method of distance.
`hclustmethod` | the method of hierarchical cluster
`action` | a character "add" will return a MPSE object with the cluster result as a attributes, and it can be extracted with 'object "only" or "get" will return 'treedata' object, default is 'get'.
`...` | additional parameters

### Value

update object with the action argument, the treedata object contained hierarchical cluster analysis of sample, it can be visualized with 'ggtree' directly.

### Author(s)

Shuangbin Xu

### Examples

    library(ggtree)
    library(ggplot2)
    data(mouse.time.mpse)
    res <- mouse.time.mpse %>%
     mp_decostand(.abundance=Abundance) %>%
     mp_cal_clust(.abundance=hellinger, distmethod="bray")
    res
    res %>%
     ggtree() +
     geom_tippoint(aes(color=time))

[Package MicrobiotaProcess version 1.4.4 Index]