Remove outlier spectra based on the pcout() function of the mvoutlier package.

remove_outliers(list_spectra, remove = TRUE)

Arguments

list_spectra

List that contains averaged spectral information in list element MIR_mean (data.frame) and metadata in data_meta (data.frame).

remove

logical expression (TRUE or FALSE) that specifies weather spectra shall be removed. If rm = FALSE, there will be no outlier removal

Value

Returns list spectra_out that contains:

  • MIR_mean: Outlier removed MIR spectra as data.frame object. If remove = FALSE, the function will return almost identical list identical to list_spectra, except that the first indices column of the spectral data frame MIR_mean is removed (This is done for both options remove = TRUE and remove = FALSE).

  • data_meta: metadata data.frame, identical as in the list_spectra input list.

  • plot_out: (optional) ggplot2 graph that shows all spectra (absorbance on x-axis and wavenumber on y-axis) with outlier marked, if remove = TRUE.

Details

This is an optional function if one wants to remove outliers.