Function first applies median and then Savitzky-Golay smoothing filters for each spectroscopic curve individually.

sp_filter(sp, k = 3, n = 25, p = 9)

Arguments

sp

hyperSpec object

k

Window for a median filter. If k = 0, median filter is not applied.

n

filter length (must be odd) for a Savitzky-Golay (SG)smoothing filter. If n = 0, SG filter is not applied.

p

filter order for a Savitzky-Golay smoothing filter

Examples

library(spHelper)
library(hyperSpec)

Original
#> Error in eval(expr, envir, enclos): object 'Original' not found
Spectra2[1]  %>% plotspc()
#> Warning: Function 'plotspc' is deprecated. 
#> Use function 'plot_spc' instead.


# Filtered
Spectra2[1]  %>% sp_filter() %>% plotspc()
#> Warning: Function 'plotspc' is deprecated. 
#> Use function 'plot_spc' instead.