Learn R Programming

spinifex (version 0.3.8)

plot_pca_scree: Plot 2 components of Principal Component Analysis

Description

Performs PCA on the data and used proto_default to plot with percent variation labels. Also appends a screeplot of the component variances.

Usage

plot_pca_scree(data, components = c(1, 2), ...)

Arguments

data

Numeric matrix or data.frame of the observations.

components

The 2 numbers of the principal components to use.

...

Optionally pass arguments to proto_default

Examples

Run this code
dat <- scale_sd(wine[, 2:6])
plot_pca_scree(data = dat)

## Different components, class coloring
clas <- as.factor(wine$Type)
plot_pca_scree(data = dat, components = c(1, 3), position = "center",
               aes_args = list(color = clas, shape = clas))

Run the code above in your browser using DataLab