DrawPCA: Draw the PCA scores or loadings of the signals

Description Usage Arguments Author(s) See Also Examples

View source: R/DrawPCA.R

Description

The function draws the PCA scores or loadings of the FIDs/spectra given in the matrix Signal_data.

Do not call this function directly but rather call Draw to specify how the plot will be returned.

Usage

1
2
3
4
DrawPCA(Signal_data, drawNames = TRUE,  main = "PCA score plot", Class = NULL, 
              axes = c(1,2), type.pca = c("scores", "loadings"), 
              loadingstype=c("l", "p"), num.stacked = 4, xlab = "rowname",
              createWindow)

Arguments

Signal_data

Matrix containing the FIDs or spectra, one line per FID/spectrum.

drawNames

If TRUE, the names of the spectra have to be shown alonside the points on the scores plot.

main

Plot title.

Class

Vector (numeric or character) indicating the class of each spectra. Used for scores plot only.

axes

Vector of score or loading numbers to be plotted. If it represents the score's numbers, only the first two elements are used.

type.pca

The type of plot, either "scores" or "loadings"

loadingstype

The type of loadings plot, either a line plot ("l") or points with histogram-like vertical lines ("p").

num.stacked

Number of stacked plots for the loadings plots.

xlab

Label of the x-axis of loadings plots.

createWindow

If TRUE, will open a new window to display the graphs.

Author(s)

BenoƮt Legat & Manon Martin

See Also

See also Draw and DrawSignal.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
require(PepsNMRData)
# Draw loadings
DrawPCA(FinalSpectra_HS, main = "PCA loadings plot", 
      Class = NULL, axes =c(1,3, 5), type ="loadings", loadingstype="l", 
      num.stacked=4, xlab="ppm", createWindow = TRUE)

# Draw scores
class = substr(rownames(FinalSpectra_HS),5,5)
DrawPCA(FinalSpectra_HS, drawNames = TRUE, main = "PCA scores plot", 
        Class = class,  axes = c(1,2), type = "scores", createWindow = TRUE)

yclement/PepsNMR documentation built on April 10, 2020, 12:07 a.m.