svd.scree: Scree plot

Description Usage Arguments Value Author(s) Examples

View source: R/svdvis.R

Description

Creates a scree plot, where percentages of variance explained (PVE) by singular vectors are plotted. Additional customizations can be done by adding ggplot2 functions to the output.

Usage

1
2
3
svd.scree(svd.obj, subr = NULL, maintitle = "Scree Plot",
  axis.title.x = "Singular Vectors",
  axis.title.y = "Percent Variance Explained")

Arguments

svd.obj

A list, resulted from applying svd to a dataset, with u, d, and v corresponding to left singular vector, singular values, and right singular vectors, respectively. Alternatively, supply a vector of singular values, d.

subr

An optional positive integer to display PVE corresponding to the first subr singular values.

maintitle

A figure title (by default, "Scree Plot").

axis.title.x

A title for x axis (by default, "Singular Vectors").

axis.title.y

A title for y axis (by default, "Percent Variance Explained").

Value

svd.scree creates and draws a figure, which is a ggplot2 when subr=NULL or a gtable object when subr is specified.

Author(s)

Neo Christopher Chung [email protected]

Examples

1
2
3
4
5
set.seed(1234)
dat = matrix(rnorm(1000), 100, 10)
svd.obj = svd(dat)
colnames(svd.obj$v) = paste0("V",1:10)
svd.scree(svd.obj)

svdvis documentation built on May 29, 2017, 3:25 p.m.