R: HCA on PCA scores from a Spectra Object

hcaScores {ChemoSpec} | R Documentation

## HCA on PCA scores from a Spectra Object

### Description

A wrapper which performs HCA on the scores from a PCA of a `Spectra` object, color-coding the results as specified in the object. Many methods for computing the clusters and distances are available.

### Usage

    hcaScores(spectra, pca, scores = c(1:5), c.method = "complete",
      d.method = "euclidean", use.sym = FALSE, leg.loc = "topright", ...)

### Arguments

`spectra` | An object of S3 class `Spectra`.
`pca` | An object of class `prcomp`, modified to include a list element called `$method`, a character string describing the pre-processing carried out and the type of PCA performed (it appears on the plot). This is automatically provided if `ChemoSpec` functions `c_pcaSpectra` or `r_pcaSpectra` were used to create `pca`.
`scores` | A vector of integers specifying which scores to use for the HCA.
`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.
`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.

### References

https://github.com/bryanhanson/ChemoSpec

### See Also

`hclust` for the underlying function. See `hcaSpectra` for HCA of the entire data set stored in the `Spectra` object. `plotHCA` for the function that actually does the plotting.

### Examples

    data(SrE.IR)
    pca <- c_pcaSpectra(SrE.IR, choice = "noscale")
    myt <- expression(bolditalic(Serenoa)~bolditalic(repens)~bold(IR~Spectra))
    res <- hcaScores(SrE.IR,  pca, scores = c(1:5), main = myt)

[Package ChemoSpec version 4.4.97 Index]