reorder_samples_by | R Documentation |
This function will reorder the user selected subgroup taxa based on abundance, and can also
reorder the stacked groups levels based on abundance, using sink_abundant_groups
reorder_samples_by(
mdf_group,
cdf,
order_tax = "NA",
group_level = "Phylum",
subgroup_level = "Genus",
sample_variable = "Sample",
sample_ordering = NA,
sink_abundant_groups = TRUE
)
mdf_group |
data.frame, data frame containing microbiome data |
cdf |
data.frame containing the color key |
group_level |
string of larger taxonomic group |
subgroup_level |
string of smaller taxonomic group |
sample_variable |
sample variable to reorder (x- axis component for plot) |
sample_ordering |
list of samples in desired order for plotting |
sink_abundant_groups |
logical reorder the phylum groups so the most abundant is the bottom group |
order |
string of subgroup to reorder by |
list
"mdf" reordered melted data frame, ready for plotting
"cdf" reordered manual color filling according to new order
library(phyloseq)
data(GlobalPatterns)
mdf <- prep_mdf(GlobalPatterns)
color_obj <- create_color_dfs(mdf)
mdf_group <- color_obj$mdf
cdf <- color_obj$cdf
mdf_new <- reorder_samples_by(mdf_group, cdf)
mdf_new <- reorder_samples_by(mdf_group, cdf, order_tax = "Bacteroides")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.