Description Usage Arguments Value Author(s) Examples
Reduce dimensionality with a method in {tsne, umap, pca}.
1 2 3 |
data |
A normalized dataframe or matrix with no missing data to be reduced in dimension. |
method |
A character string as the name of the method. Available values are "pca" (the default), "tsne", "umap". |
annot1 |
A vector of continuous or factor values to color samples in the resulted plot (the order of values should be the same as the order of rows in data). Default to NULL. |
annot1.name |
The name of the variable indicating annot1 vector. Defaults to "annot1". |
annot2 |
A vector of factor values indicating sample shapes to plot (the order of values should be the same as the order of rows in data). Default to NULL. |
annot2.name |
The name of the variable indicating annot2 vector. Defaults to "annot2". |
levels |
An integer value indicating the maximum number of levels of a categorical variable. To be used to distinguish the categorical variable.
Defaults to NULL because it is supposed that |
A plot of data points in the 2 dimensional space.
Elyas Heidari
1 2 3 4 5 6 7 8 | data("NHANES")
## Using different methods on the raw data
df <- NHANES[sample(nrow(NHANES), 500), ]
plt_pca <- dim_reduce(df, method = "pca", levels = 15)
plt_tsne <- dim_reduce(df, method = "tsne", annot1 = df$BMXBMI, annot1.name = "BMI", levels = 15)
plt_umap <- dim_reduce(df, method = "umap", annot1 = df$LBXTC, annot1.name = "Total Cholesterol",
annot2 = as.factor(df$RIAGENDR), annot2.name = "Gender", levels = 15)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.