## splitting and merging of data files
data(tea)
tea.split <- splitTimeWindow(tea.raw, c(12, 14))
names(tea.split)
sapply(tea.split, length)
lapply(tea.split, function(x) sapply(x, dim))
rownames(tea.split[[1]][[1]])[1:10]
rownames(tea.split[[2]][[1]])[1:10]
tea.merge <- mergeTimeWindows(tea.split)
all.equal(tea.merge, tea.raw) ## should be TRUE
tea.split2 <- splitTimeWindow(tea.raw, c(12, 14), overlap = 10)
lapply(tea.split2, function(x) sapply(x, dim))
tea.merge2 <- mergeTimeWindows(tea.split2)
all.equal(tea.merge2, tea.raw) ## should be TRUE
## merging of ALS results
data(teaMerged)
ncomp <- ncol(teaMerged$S)
myPalette <- colorRampPalette(c("black", "red", "blue", "green"))
mycols <- myPalette(ncomp)
## show spectra - plotting only a few of them is much more clear...
plot(teaMerged, what = "spectra", col = mycols, comp.idx = c(2, 6))
legend("top", col = mycols[c(2, 6)], lty = 1, bty = "n",
legend = paste("C", c(2, 6)))
## show concentration profiles - all six files
plot(teaMerged, what = "profiles", col = mycols)
## only the second file
plot(teaMerged, what = "profiles", mat.idx = 2, col = mycols)
legend("topleft", col = mycols, lty = 1, bty = "n",
legend = paste("C", 1:ncol(teaMerged$S)))
## Note that components 2 and 6 are continuous across the window borders
## - these are found in all three windows
Run the code above in your browser using DataLab