| distance {phyloseq} | R Documentation |
Takes a phyloseq-class object and method option, and returns
a distance object suitable for certain
ordination methods and other distance-based analyses.
Only
sample-wise distances are currently supported (the type argument),
but eventually species-wise (OTU-wise)
distances may be supported as well.
distance(physeq, method, type = "samples", ...) ## S4 method for signature 'phyloseq,ANY' distance(physeq, method) ## S4 method for signature 'otu_table,character' distance(physeq, method, type = "samples", ...) ## S4 method for signature 'phyloseq,character' distance(physeq, method, type = "samples", ...)
physeq |
(Required). A |
method |
(Required). A character string.
Provide one of the currently supported options.
See Note that for the common definition of The following methods are implemented explicitly within
the
Alternatively, you can provide
a character string that defines a custom distance method, if it has the form
described in |
type |
(Optional). A character string. The type of pairwise comparisons
being calculated: sample-wise or taxa-wise. The default is
|
... |
Additional arguments passed on to the appropriate distance
function, determined by the |
Depending on the method
argument, distance() wraps one of
UniFrac,
DPCoA,
JSD,
vegdist,
betadiver,
designdist, or
dist.
An object of class “dist” suitable for certain
ordination methods and other distance-based analyses.
plot_ordination,
UniFrac,
DPCoA,
JSD,
vegdist,
betadiver,
designdist,
dist.
data(esophagus)
distance(esophagus, "uunifrac") # Unweighted UniFrac
distance(esophagus, "wunifrac") # weighted UniFrac
distance(esophagus, "jaccard", binary = TRUE) # vegdist jaccard
distance(esophagus, "gower") # vegdist option "gower"
distance(esophagus, "g") # designdist method option "g"
distance(esophagus, "minkowski") # invokes a method from the base dist() function.
distance(esophagus, "(A+B-2*J)/(A+B)") # designdist custom distance
distanceMethodList
help("distance")