svd.scatter: Visualizing Singular Vectors or Principal Components by...

Description Usage Arguments Value Author(s) See Also Examples

View source: R/svdvis.R

Description

Creates a set of multiple scatter plots from all pairs of selected singular vectors or principal components. Principal components can be plotted by setting weights = "sv". Since it largely uses ggpairs from the GGally package, optional arguments for ggpairs can be specified.

Usage

1
2
svd.scatter(svd.obj, r = NULL, group = NULL, weights = NULL,
  alpha = 0.7, axisLabels = "none", ...)

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 singular vectors, v.

r

A positive integer to use only the first r vectors in visualization. If not specified, all vectors available in svd.obj$v are visualized.

group

A vector of length n, specifying groups (e.g., phenotypes or conditions for n samples).

weights

A vector of length r. If "sv", singular values contained in svd.obj$d[1:r] are used.

alpha

A numeric value for transparency.

axisLabels

Set to either "none" (default), "show", or "internal".

...

Additional arguments to pass onto ggpair.

Value

svd.scatter creates and draws a figure, which is a ggpair object.

Author(s)

Neo Christopher Chung nchchung@gmail.com

See Also

ggpairs

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.scatter(svd.obj, r=3, group=c(rep("Group1",5), rep("Group2",5)))

Example output

[1] "Your input data is treated as a SVD output, with u, d, v corresponding to left singular vector, singular values, and right singular vectors, respectively."
[1] "Multiple Scatter Plots"
Warning messages:
1: In warn_if_args_exist(list(...)) :
  Extra arguments: 'color', 'alpha' are being ignored.  If these are meant to be aesthetics, submit them using the 'mapping' variable within ggpairs with ggplot2::aes or ggplot2::aes_string.
2: In check_and_set_ggpairs_defaults("diag", diag, continuous = "densityDiag",  :
  Changing diag$continuous from 'density' to 'densityDiag'

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