Learn R Programming

rchemo (version 0.1-3)

rmgap: 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)

Value

The corrected data \(X\).

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 indexcol = c(651, 1451).

k

The number of columns used on the left side of the gaps for fitting the linear regressions.

Examples

Run this code

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)

Run the code above in your browser using DataLab