taxon_sort_gather: Transform data from wide to long, join a taxonomic level,...

Description Usage Arguments Value Examples

View source: R/taxon_sort_gather.R

Description

Transform data from wide to long, join a taxonomic level, aggregate and create summary statistics, and return n OTUs.

Usage

1
2
3
4
5
6
7
8
taxon_sort_gather(
  df,
  n = 50,
  facet_var = NULL,
  ord_val = NULL,
  tax_df = otu_good_taxonomy,
  tax_level = "Phylum"
)

Arguments

df

Dataframe containing metadata and taxon (Phylum, Otu, etc) abundance data in wide format.

n

Number of OTUs to return, 50 by default. Fewer results will be returned if there are not enough entities with non-zero abundances.

facet_var

Variable to be used for grouping and eventual faceting, possibly in plot_ra.

ord_val

Level with the facet_var to be used for ranking OTUs.

tax_df

Taxonomy table. Passed to join_tax. Defaults to otu_good_taxonomy.

tax_level

Taxonomic level to join from tax_df, the levels within which will be used for grouping. Defaults to Phylum.

Value

A dataframe that has been aggregated and reshaped into long form.

Examples

1
2
filt_ord_facet_df <- dplyr::filter(otu_good_14d, Day == 0, Organ == "Feces") %>%
  taxon_sort_gather(facet_var = "Treatment_group", ord_val = "untreated", tax_level = "Phylum")

cb-42/cbmbtools documentation built on Jan. 9, 2021, 1:38 a.m.