Replace NA
s in the spectra matrix by interpolation. With
less than 4 points available linear interpolation of the 2 neighbor points
is used. For larger numbers of neighbor points, smoothing interpolation is
performed by stats::smooth.spline()
.
spc_na_approx( spc, neighbours = 1, w = rep(1, 2 * neighbours), df = 1 + .Machine$double.eps, spar = NULL, debuglevel = hy.getOption("debuglevel") )
spc | hyperSpec object with spectra matrix containing |
---|---|
neighbours | how many neighbor data points should be used to fit the line |
w, df, spar | |
debuglevel | see |
hyperSpec object
Claudia Beleites
fluNA <- hyperSpec:::fluNA spc_na_approx(fluNA[, , min ~ 410], debuglevel = 1)#> Warning: Spectra containing only NAs found. They will not be approximated.#> hyperSpec object #> 6 spectra #> 3 data columns #> 11 data points / spectrumspc_na_approx(fluNA[1, , min ~ 410], debuglevel = 2)#> hyperSpec object #> 1 spectra #> 3 data columns #> 11 data points / spectrumspc_na_approx(fluNA[4, , min ~ 410], neighbours = 3, df = 4, debuglevel = 2)#> hyperSpec object #> 1 spectra #> 3 data columns #> 11 data points / spectrum