Skip to contents

Subset the highest or lowest abundance samples from a relative abundance table.

Usage

subset_high_low(rel_abund_tb, subset = "low", n = 10, flip = FALSE)

Arguments

rel_abund_tb

A relative abundance table in tibble form.

subset

The subset choice, of "high" or "low"

n

The number of samples.

flip

Subset the opposite set of samples, logical.

Value

A tibble.

Examples

rel_abund_phy(phy = physeq) %>%
  subset_high_low(n = 5)
#> # A tibble: 100 × 5
#>    sample_id asv   level  taxon           rel_abund
#>    <chr>     <chr> <chr>  <chr>               <dbl>
#>  1 Smp6      ASV1  Phylum Pseudomonadota 0         
#>  2 Smp6      ASV2  Phylum Spirochaetota  0.0000318 
#>  3 Smp6      ASV3  Phylum Pseudomonadota 0.00000635
#>  4 Smp6      ASV4  Phylum Pseudomonadota 0.00000423
#>  5 Smp6      ASV5  Phylum Actinomycetota 0         
#>  6 Smp6      ASV6  Phylum Actinomycetota 0.0000127 
#>  7 Smp6      ASV7  Phylum Pseudomonadota 0         
#>  8 Smp6      ASV8  Phylum Bacillota      0         
#>  9 Smp6      ASV9  Phylum Pseudomonadota 0.00000423
#> 10 Smp6      ASV10 Phylum Bacteroidota   0.000246  
#> # ℹ 90 more rows