rmgap {rchemo} | R Documentation |
Removing vertical gaps in spectra
Description
Remove the vertical gaps in spectra (rows of matrix X
), e.g. for ASD. This is done by extrapolation from simple linear regressions computed on the left side of the gaps.
Usage
rmgap(X, indexcol, k = 5)
Arguments
X |
A dataset. |
indexcol |
The column indexes corresponding to the gaps. For instance, if two gaps are observed between indexes 651-652 and between indexes 1451-1452, respectively, then |
k |
The number of columns used on the left side of the gaps for fitting the linear regressions. |
Value
The corrected data X
.
Note
In the example, two gaps are at wavelengths 1000-1001 nm and 1800-1801 nm.
Examples
data(asdgap)
X <- asdgap$X
indexcol <- which(colnames(X) == "1000" | colnames(X) == "1800")
indexcol
plotsp(X, lwd = 1.5)
abline(v = as.numeric(colnames(X)[1]) + indexcol - 1, col = "lightgrey", lty = 3)
zX <- rmgap(X, indexcol = indexcol)
plotsp(zX, lwd = 1.5)
abline(v = as.numeric(colnames(zX)[1]) + indexcol - 1, col = "lightgrey", lty = 3)
[Package rchemo version 0.1-2 Index]