Reorder samples based on sample_data columns. Supports the . pronoun
to refer to the phyloseq object for sorting by computed values.
Arguments
- physeq
(phyloseq, required) A phyloseq object.
- ...
Variables to sort by. Use desc()for descending order. Use.to refer to the phyloseq object.- clean_phyloseq_object
if TRUE (default), the resulting phyloseq object is cleaned using
clean_pq()to remove empty taxa/samples.
Examples
library(MiscMetabar)
# Arrange by a single column
arrange_samples_pq(data_fungi, Height)
#> phyloseq-class experiment-level object
#> otu_table() OTU Table: [ 67 taxa and 1 samples ]
#> sample_data() Sample Data: [ 1 samples by 7 sample variables ]
#> tax_table() Taxonomy Table: [ 67 taxa by 12 taxonomic ranks ]
#> refseq() DNAStringSet: [ 67 reference sequences ]
# Arrange by sequencing depth (descending)
arrange_samples_pq(data_fungi, dplyr::desc(sample_sums(.)))
#> phyloseq-class experiment-level object
#> otu_table() OTU Table: [ 67 taxa and 1 samples ]
#> sample_data() Sample Data: [ 1 samples by 7 sample variables ]
#> tax_table() Taxonomy Table: [ 67 taxa by 12 taxonomic ranks ]
#> refseq() DNAStringSet: [ 67 reference sequences ]