This is just a wrapper of rrarefy with convenient error messages and adjusted to work with ampvis2 objects.

amp_rarefy(data, rarefy)

Arguments

data

(required) Data list as loaded with amp_load.

rarefy

(required) Passed directly to rrarefy.

Value

An ampvis2 object with rarefied OTU abundances.

Author

Kasper Skytte Andersen ksa@bio.aau.dk

Examples

data("AalborgWWTPs")
AalborgWWTPs
#> ampvis2 object with 5 elements. 
#> Summary of OTU table:
#>      Samples         OTUs  Total#Reads    Min#Reads    Max#Reads Median#Reads 
#>           67         9430      2045128        17772        44326        31209 
#>    Avg#Reads 
#>      30524.3 
#> 
#> Assigned taxonomy:
#>      Kingdom       Phylum        Class        Order       Family        Genus 
#>   9430(100%) 9215(97.72%) 8282(87.83%) 7644(81.06%) 6746(71.54%) 5228(55.44%) 
#>      Species 
#>    23(0.24%) 
#> 
#> Metadata variables: 5 
#>  SampleID, Plant, Date, Year, Period
rarefied <- amp_rarefy(AalborgWWTPs, 20000)
#> The following sample(s) have not been rarefied (less than 20000 reads):
#> 16SAMP-703, 16SAMP-739, 16SAMP-10907
rarefied
#> ampvis2 object with 5 elements. 
#> Summary of OTU table:
#>      Samples         OTUs  Total#Reads    Min#Reads    Max#Reads Median#Reads 
#>           67         9430      1337554        17772        20000        20000 
#>    Avg#Reads 
#>     19963.49 
#> 
#> Assigned taxonomy:
#>      Kingdom       Phylum        Class        Order       Family        Genus 
#>   9430(100%) 9215(97.72%) 8282(87.83%) 7644(81.06%) 6746(71.54%) 5228(55.44%) 
#>      Species 
#>    23(0.24%) 
#> 
#> Metadata variables: 5 
#>  SampleID, Plant, Date, Year, Period