if (checkForPackageWithVersion("ChemoSpec", 6.0)) {
library("ChemoSpec")
# This example assumes the graphics output is set to ggplot2 (see ?GraphicsOptions).
library("ggplot2")
data(metMUD1)
pca <- c_pcaSpectra(metMUD1)
p <- plotScores(metMUD1, pca, pcs = c(1, 2), ellipse = "cls", tol = 0.05)
p <- p + ggtitle("metMUD1 NMR Data")
p
}
if (checkForPackageWithVersion("ChemoSpec2D", 0.5)) {
library("ChemoSpec2D")
library("ggplot2")
data(MUD1)
mia <- miaSpectra2D(MUD1)
p1 <- plotScores(MUD1, mia, tol = 0.1, ellipse = "cls")
p1 <- p1 + ggtitle("MIA Scores")
p1
set.seed(123)
pfac <- pfacSpectra2D(MUD1, parallel = FALSE, nfac = 2)
p2 <- plotScores(MUD1, pfac, tol = 0.1, leg.loc = "bottomright")
p2 <- p2 + ggtitle("PARAFAC Score Plot")
p2
}
Run the code above in your browser using DataLab