The dr()
function apply the function, fun
,
and (if any) parameters to analyze the input ‘data’.
The data can be original data matrix (or data frame), or distance matrix (or distance object), depending on the requirement of the DR method (specify by the ‘fun’ parameter).
Methods supported by the dr()
function can be listed via
the available_methods()
:
## The `dr()` function works for the following methods that
## require data matrix (or data frame) as input:
## + stats::prcomp()
## + Rtsne::Rtsne()
## + uwot::umap()
## + uwot::tumap()
## + uwot::lvish()
## The `dr()` function works for the following methods that
## require distance matrix (or distance object) as input:
## + stats::cmdscale()
## + MASS::sammon()
## + vegan::metaMDS()
## + ape::pcoa()
## + smacof::mds()
## + vegan::wcmdscale()
## + ecodist::pco()
## + labdsv::pco()
## + ade4::dudi.pco()
The tidydr
package extends ggplot()
to
support the output of dr()
function.
Associated data (e.g., group information) can be integrated to scale
the color, shape or size of data points. The data should be provided via
the metadata
parameter. It allows a vector (will be stored
in .group
) or a data frame.
library(ggplot2)
## metadata as a vector
ggplot(x, aes(Dim1, Dim2), metadata=iris$Species) +
geom_point(aes(color=.group))
Users can use autoplot()
as a shortcut. This package
provide a theme, theme_dr()
, to allow using shorten
axes.