transform_sample_counts | R Documentation |
otu_table
, sample-by-sample.This function transforms the sample counts of a taxa abundance matrix according to a user-provided function. The counts of each sample will be transformed individually. No sample-sample interaction/comparison is possible by this method.
transform_sample_counts(physeq, fun, ...) transformSampleCounts(physeq, fun, ...)
physeq |
(Required). |
fun |
(Required). A single-argument function that will be applied
to the abundance counts of each sample.
Can be an anonymous |
... |
(Optional). Additional, optionally-named, arguments passed to
|
A transformed otu_table
– or phyloseq
object with its
transformed otu_table
.
In general, trimming is not expected by this
method, so it is suggested that the user provide only functions that return
a full-length vector. Filtering/trimming can follow, for which the
genefilter_sample
and prune_taxa
functions
are suggested.
threshrankfun
, rank
, log
# data(esophagus) x1 = transform_sample_counts(esophagus, threshrankfun(50)) head(otu_table(x1), 10) x2 = transform_sample_counts(esophagus, rank) head(otu_table(x2), 10) identical(x1, x2) x3 = otu_table(esophagus) + 5 x3 = transform_sample_counts(x3, log) head(otu_table(x3), 10) x4 = transform_sample_counts(esophagus, function(x) round(x^2.2, 0)) head(otu_table(x4), 10)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.