phyloseq-class
object and method option, and returns
a dist
ance 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", ...)## S3 method for class 'phyloseq,ANY':
distance(physeq, method)
## S3 method for class 'otu_table,character':
distance(physeq, method, type = "samples",
...)
## S3 method for class 'phyloseq,character':
distance(physeq, method, type = "samples", ...)
phyloseq-class
or
an otu_table-class
object. The latter is only appropriate
for methods that do not require any additional data (one-table).
For example, the ``wunifrac'' option (UniFrac
) requires
phyloseq-class
that contains both an otu_table
and a phylogenetic tree (phylo
).distanceMethodList
for a detailed list
of the supported options here,
and links to accompanying documentation.
Note that for the common definition of Jaccard
distance
using the vegan-package
implementation,
an additional argument is needed, with the full call having the form:
distance(physeq, method = "jaccard", binary = TRUE)
The following methods are implemented explicitly within
the phyloseq-package
,
and accessed by the following method
options:
[object Object],[object Object],[object Object],[object Object] Alternatively, you can provide
a character string that defines a custom distance method, if it has the form
described in designdist
.
c("samples")
.method
argument.dist
'' suitable for certain
ordination methods and other distance-based analyses.method
argument, distance()
wraps one of
UniFrac
,
DPCoA
,
JSD
,
vegdist
,
betadiver
,
designdist
, or
dist
.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")
Run the code above in your browser using DataLab