chondro
## do baseline correction
baselines <- spc.fit.poly.below (chondro)
chondro <- chondro - baselines
## area normalization
chondro <- chondro / colMeans (chondro)
## substact common composition
chondro <- chondro - quantile (chondro, 0.05)
## PCA
pca <- prcomp (~ spc, data = chondro, center = TRUE)
scores <- decomposition (chondro, pca$x, label.wavelength = "PC", label.spc = "score / a.u.")
loadings <- decomposition (chondro, pca$rotation, scores = FALSE, label.spc = "loading I / a.u.")
center <- decomposition (chondro, pca$center, scores = FALSE)
# remove outliers
out <- c(105, 140, 216, 289, 75, 69)
chondro <- chondro [- out]
# Hierarchical cluster analysis
# calculation omitted for speed - see vignette for details
cols <- c ("dark blue", "orange", "#C02020")
plotmap (chondro, clusters ~ x * y, col.regions = cols)
cluster.means <- aggregate (chondro, chondro$clusters, mean_pm_sd)
plot (cluster.means, stacked = ".aggregate", fill = ".aggregate", col = cols)
## plot nucleic acids
plotmap (chondro[, , c( 728, 782, 1098, 1240, 1482, 1577)],
col.regions = colorRampPalette (c("white", "gold", "dark green"), space = "Lab") (20))
vignette ("chondro", package = "hyperSpec")
Run the code above in your browser using DataLab