Convenience function to normalize spectroscopic data in a hyperSpec object.

sp_normalize(sp, norm = "max_I", in_range = min ~ max, at = NULL)

Arguments

sp

hyperSpec object.

norm

("I" | "I_max" | "I_mean" | "area" | "max" | "mean" )
a way of normalization.

in_range, at

(numeric | formula)
either a single numeric value or a pair of values describing the range (e.g., 300~350) of wavelengths to be used for normalization. Default is range = min~max.

Value

sp with normalized spectra in (sp@data$spc).

Examples


library(magrittr)


Spectra2 %>% plotspc()
#> Warning: Function 'plotspc' is deprecated. 
#> Use function 'plot_spc' instead.


Spectra2 %>% sp_normalize() %>% plotspc()
#> Warning: Function 'plotspc' is deprecated. 
#> Use function 'plot_spc' instead.


Spectra2 %>% sp_normalize("I", 720) %>% plotspc()
#> Warning: Function 'plotspc' is deprecated. 
#> Use function 'plot_spc' instead.


Spectra2 %>% sp_normalize("area") %>% plotspc()
#> Warning: Function 'plotspc' is deprecated. 
#> Use function 'plot_spc' instead.

Spectra2 %>% sp_normalize("area", 300~400) %>% plotspc()
#> Warning: Function 'plotspc' is deprecated. 
#> Use function 'plot_spc' instead.