Learn R Programming

spinifex (version 0.3.8)

plot_pca: Plot 2 components of Principal Component Analysis

Description

Performs PCA on the data and used proto_default to plot with percent variation labels.

Usage

plot_pca(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

See Also

proto_default()

Examples

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

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

Run the code above in your browser using DataLab