View source: R/dim_reduction.R
showme_PCA2D | R Documentation |
Given a matrix show me the principal components and other neat things.
showme_PCA2D(
mat,
x = 1,
y = x + 1,
mt,
mcol,
m_fill = mcol,
m_label = FALSE,
n_top_var = 500,
filt_mat = FALSE,
NA_filt_thrshld = 0.95,
show_variance = FALSE,
show_stats = FALSE,
n_loadings = NULL,
return_data = FALSE,
real_aspect_ratio = TRUE,
...
)
mat |
A matrix |
x |
Integer indicating principal component on X-axis. Default 1. |
y |
Integer indicating principal component on Y-axis. Default |
mt |
|
mcol |
Character specifying one column of |
m_fill |
Character specifying one column name of |
m_label |
Character or logical specifying one column name of |
n_top_var |
Integer: Number of most variable matrix rows to use for |
filt_mat |
Logical. Whether or not to remove certain rows from |
NA_filt_thrshld |
Integer between 0 and 1: maximum % of NA accepted on |
show_variance |
Logical. Show an extra plot with the variance on each component. |
show_stats |
Logical. Show an extra plot with the summary statistics for the data in |
n_loadings |
Integer indicating how many top and bottom loadings to plot. |
return_data |
Logical. If |
... |
Set extra parameter for the |
real_aspect_raio |
Logical. If |
Either a plot (created with ggplot2
), a combination of plots ( created with patchwork
) or a data.frame
.
showme_PCA2D(mat)
showme_PCA2D(mat = mat, mt = mt, mcol = "sample_name", m_fill = "replicate",
x = 3, show_stats = T, m_label = F)
showme_PCA2D(mat = mat, mt = mt, mcol = "sample_name", n_loadings = 12)
# Working with metadata
data.frame(sample_name = paste0("Sample", 0:9),
replicate = c(rep(c(1:3), 3), 1),
condition = c(rep("A", 5), rep("Z", 5)),
stringsAsFactors = FALSE) -> mt
showme_PCA2D(mat = mat, mt = mt) # does not work cause `mcol` is not specified.
# This works instead because the `mcol` is specified.
showme_PCA2D(mat = mat, mt = mt, mcol = "sample_name", m_label = "replicate")
# This throws a warning dropping `mcol` as there's no metadata provided.
showme_PCA2D(mat = mat, mcol = "sample_name")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.