hcaScores: HCA on PCA/MIA/PARAFAC scores from a Spectra or Spectra2D...

Description Usage Arguments Value Author(s) See Also Examples

View source: R/hcaScores.R

Description

A wrapper which performs HCA on the scores from a PCA of a Spectra object or POP/MIA/PARAFAC of a Spectra2D object. Many methods for computing the clusters and distances are available.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
hcaScores(
  spectra,
  so,
  scores = c(1:5),
  c.method = "complete",
  d.method = "euclidean",
  use.sym = FALSE,
  leg.loc = "topright",
  ...
)

Arguments

spectra

An object of S3 class Spectra or Spectra2D object.

so

"Score Object" One of the following:

  • An object of class prcomp, created by ChemoSpec functions c_pcaSpectra, r_pcaSpectra, irlba_pcaSpectra or s_pcaSpectra.

  • An object of class mia produced by function miaSpectra2D.

  • An object of class parafac produced by function pfacSpectra2D.

  • An object of class pop produced by function popSpectra2D.

Any of the above score objects will have been modified to include a list element called $method, a character string describing the pre-processing carried out and the type of PCA performed (used to annotate the plot).

scores

A vector of integers specifying the components (scores) to plot.

c.method

A character string describing the clustering method; must be acceptable to hclust.

d.method

A character string describing the distance calculation method; must be acceptable as a method in rowDist.

use.sym

A logical; if true, use no color and use lower-case letters to indicate group membership. Applies only to Spectra objects.

leg.loc

Character; if "none" no legend will be drawn. Otherwise, any string acceptable to legend.

...

Additional parameters to be passed to the plotting functions.

Value

A list, containing an object of class hclust and an object of class dendrogram. The side effect is a plot.

Author(s)

Bryan A. Hanson, DePauw University.

See Also

hclust for the underlying function. See hcaSpectra for HCA of the entire data set stored in the Spectra object.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
if (checkForPackageWithVersion("ChemoSpec", "5.1")) {
  library("ChemoSpec")
  data(metMUD1)

  pca <- c_pcaSpectra(metMUD1)
  hca <- hcaScores(metMUD1, pca, main = "metMUD1 NMR Data PCA Scores")
}

if (checkForPackageWithVersion("ChemoSpec2D", "0.3")) {
  library("ChemoSpec2D")
  data(MUD1)

  mia <- miaSpectra2D(MUD1)
  hca <- hcaScores(MUD1, mia, scores = 1:2, main = "MUD1 MIA Scores")

  set.seed(123)
  pfac <- pfacSpectra2D(MUD1, parallel = FALSE, nfac = 2)
  hca <- hcaScores(MUD1, pfac, scores = 1:2, main = "MUD1 PARAFAC Scores")
}

ChemoSpecUtils documentation built on March 16, 2021, 1:08 a.m.