Learn R Programming

DataExplorer (version 0.6.0)

plot_prcomp: Visualize principle component analysis

Description

Visualize output of prcomp.

Usage

plot_prcomp(data, variance_cap = 0.8, maxcat = 50L, title = NULL,
  ggtheme = theme_gray(), theme_config = list(), ...)

Arguments

data

input data

variance_cap

maximum cumulative explained variance allowed for all principle components. Default is 80%.

maxcat

maximum categories allowed for each discrete feature. The default is 50.

title

plot title starting from page 2.

ggtheme

complete ggplot2 themes. The default is theme_gray.

theme_config

a list of configurations to be passed to theme.

other arguments to be passed to prcomp.

Details

When cumulative explained variance exceeds variance_cap, remaining principle components will be ignored. Set variance_cap to 1 for all principle components.

Discrete features containing more categories than maxcat specifies will be ignored.

To change default font family and size, you may pass base_size and base_family to ggtheme options, e.g., ggtheme = theme_gray(base_size = 15, base_family = "serif")

theme_config argument expects all inputs to be wrapped in a list object, e.g., to change the text color: theme_config = list("text" = element_text(color = "blue"))

Examples

Run this code
# NOT RUN {
data("diamonds", package = "ggplot2")
plot_prcomp(diamonds, maxcat = 5, scale. = TRUE)
# }

Run the code above in your browser using DataLab