View source: R/pca_functions.R
pca_data | R Documentation |
Extract PCA data and grouping for further analysis or publication-quality plots.
pca_data(data, vars, samples = "rowname", scale = T, var_scaling = 5)
data |
Input dataset. |
vars |
Selection of columns from input dataset to perform the PCA on. All data within these columns be numerical. Any rows with missing values will be dropped. Accepts the following input types:
|
samples |
Optional column to provide unique sample identifier. Otherwise, rownames are used. |
scale |
Boolean. If TRUE, then correlation PCA. if FALSE, then covariance PCA. |
var_scaling |
Multiplier for raw variable loadings. Helps scale them to similar values as sample loadings most of the time. Set to FALSE for raw output. |
This returns a named list of data frames:
pervar contains the percent variance explained by each principal component.
vars contains the variable loadings on each principal component. These may have been scaled by var_scaling for easier plotting.
samples contains the sample loadings on each principal component.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.