View source: R/tab_dimensionreduction.R
dimensionReduction | R Documentation |
The function dimensionReduction
creates a data.frame
with the coordinates of the projected data (first entry of returned output).
The function allows for the
following projections:
Principal Component Analysis (PCA), Principal Coordinates
Analysis/Multidimensional Scaling (PCoA), Non-metric Multidimensional
scaling (NMDS), t-distributed stochastic neighbor embedding (tSNE), and
Uniform Manifold Approximation and Projection (UMAP).
The second list entry will contains the object returned from
prcomp
(PCA), cmdscale
(PCoA), isoMDS
(NMDS),
Rtsne
(tSNE), or umap
(UMAP).
dimensionReduction(
x,
type = c("PCA", "PCoA", "NMDS", "tSNE", "UMAP"),
params = list()
)
x |
|
type |
|
params |
|
The function dimensionReduction
is a wrapper around the following
functions stats::prcomp
(PCA), stats::cmdscale
(PCoA),
MASS::isoMDS
(NMDS), Rtsne::Rtsne
(tSNE), and
umap::umap
(UMAP). For the function umap::umap
the method is set to naive
.
list, first entry contains a tbl
, second entry contains
the object returned from prcomp
(PCA), cmdscale
(PCoA),
isoMDS
(NMDS), Rtsne
(tSNE), or umap
(UMAP)
Thomas Naake
x <- matrix(rnorm(seq_len(10000)), ncol = 100)
rownames(x) <- paste("feature", seq_len(nrow(x)))
colnames(x) <- paste("sample", seq_len(ncol(x)))
params <- list(method = "euclidean", ## dist
initial_dims = 10, max_iter = 100, dims = 3, perplexity = 3, ## tSNE
min_dist = 0.1, n_neighbors = 15, spread = 1) ## UMAP
dimensionReduction(x, type = "PCA", params = params)
dimensionReduction(x, type = "PCoA", params = params)
dimensionReduction(x, type = "NMDS", params = params)
dimensionReduction(x, type = "tSNE", params = params)
dimensionReduction(x, type = "UMAP", params = params)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.