mp_cal_upset {MicrobiotaProcess} | R Documentation

## Calculating the samples or groups for each OTU, the result can be visualized by 'ggupset'

### Description

Calculating the samples or groups for each OTU, the result can be visualized by 'ggupset'

### Usage

    mp_cal_upset(
      .data,
      .group,
      .abundance = NULL,
      action = "add",
      force = FALSE,
      ...
    )

    ## S4 method for signature 'MPSE'
    mp_cal_upset(
      .data,
      .group,
      .abundance = NULL,
      action = "add",
      force = FALSE,
      ...
    )

    ## S4 method for signature 'tbl_mpse'
    mp_cal_upset(
      .data,
      .group,
      .abundance = NULL,
      action = "add",
      force = FALSE,
      ...
    )

    ## S4 method for signature 'grouped_df_mpse'
    mp_cal_upset(
      .data,
      .group,
      .abundance = NULL,
      action = "add",
      force = FALSE,
      ...
    )

### Arguments

`.data` | MPSE or tbl_mpse object
`.group` | the name of group to be calculated. if it is no provided, the sample will be used.
`.abundance` | the name of otu abundance to be calculated. if it is null, the rarefied abundance will be used.
`action` | character, "add" joins the new information to the tibble of tbl_mpse or rowData of MPSE. "only" and "get" return a non-redundant tibble with the just new information. which is a treedata object.
`force` | logical whether calculate the relative abundance forcibly when the abundance is not be rarefied, default is FALSE.
`...` | additional parameters.

### Value

update object or tibble according the 'action'

### Author(s)

Shuangbin Xu

### See Also

[mp_plot_upset()]

### Examples

    data(mouse.time.mpse)
    mpse <- mouse.time.mpse %>%
            mp_rrarefy() %>%
            mp_cal_upset(.abundance=RareAbundance, .group=time, action="add")
    mpse
    library(ggplot2)
    library(ggupset)
    p <- mpse %>% mp_plot_upset(.group=time, .upset=ggupsetOftime)
    p
    # or set action="only"
    ## Not run:
    tbl <- mouse.time.mpse %>%
           mp_rrarefy() %>%
           mp_cal_upset(.abundance=RareAbundance, .group=time, action="only")
    tbl
    p2 <- tbl %>%
          ggplot(aes(x=ggupsetOftime)) +
          geom_bar() +
          ggupset::scale_x_upset() +
          ggupset::theme_combmatrix(combmatrix.label.extra_spacing=30)

    ## End(Not run)

[Package MicrobiotaProcess version 1.4.4 Index]