ggbetween_pq: Box/Violin plots for between-subjects comparisons of Hill...

View source: R/plot_functions.R

ggbetween_pqR Documentation

Box/Violin plots for between-subjects comparisons of Hill Number

Description

lifecycle-experimental

Note that contrary to hill_pq(), this function does not take into account for difference in the number of sequences per samples/modalities. You may use rarefy_by_sample = TRUE if the mean number of sequences per samples differs among modalities.

Basically a wrapper of function ggstatsplot::ggbetweenstats() for object of class phyloseq

Usage

ggbetween_pq(physeq, fact, one_plot = FALSE, rarefy_by_sample = FALSE, ...)

Arguments

physeq

(required): a phyloseq-class object obtained using the phyloseq package.

fact

(required): The variable to test. Must be present in the sam_data slot of the physeq object.

one_plot

(logical, default FALSE) If TRUE, return a unique plot with the three plot inside using the patchwork package.

rarefy_by_sample

(logical, default FALSE) If TRUE, rarefy samples using phyloseq::rarefy_even_depth() function

...

Other arguments passed on to ggstatsplot::ggbetweenstats() function.

Details

This function is mainly a wrapper of the work of others. Please make a reference to ggstatsplot::ggbetweenstats() if you use this function.

Value

Either an unique ggplot2 object (if one_plot is TRUE) or a list of 3 ggplot2 plot:

  • plot_Hill_0 : the ggbetweenstats of Hill number 0 (= species richness) against the variable fact

  • plot_Hill_1 : the ggbetweenstats of Hill number 1 (= Shannon index) against the variable fact

  • plot_Hill_2 : the ggbetweenstats of Hill number 2 (= Simpson index) against the variable fact

Author(s)

Adrien Taudière

Examples


if (requireNamespace("ggstatsplot")) {
  p <- ggbetween_pq(data_fungi, fact = "Time", p.adjust.method = "BH")
  p[[1]]
  ggbetween_pq(data_fungi, fact = "Height", one_plot = TRUE)
  ggbetween_pq(data_fungi, fact = "Height", one_plot = TRUE, rarefy_by_sample = TRUE)
}


adrientaudiere/MiscMetabar documentation built on Oct. 13, 2024, 9:42 p.m.