Preprocesses spectra in tibble column by sample_id after averaging spectra by simplerspec::average_spc().

preprocess_spc(spc_tbl, select, column_in = "spc_mean", custom_function = NULL)

Arguments

spc_tbl

Tibble that contains spectra to be preprocessed within a list-column.

select

Character vector of predefined preprocessing options to be applied to the spectra list-column specified in column_in. Common prefined values are stated as abbreviated preprocessing methods and options such as "sg_1_w21", where "sg" stands for Savitzky-Golay and 1 for first derivative and "w21" for a window size of 21 points.

column_in

Character vector of single list-column in spc_tbl that contain list of spectra (1 row matrix) to be processed by function supplied in select.

custom_function

A character string of a custom processing function that is later parsed (produces expression in a list) and evaluated within the function preprocess_spc. The character vector argument of custom_function needs to contain "spc_raw", which is the single data table of spectra that results from binding a list of data.tables (spectra to preprocess) from the spectra list-column specified in column_in. An example for a value is "prospectr::savitzkyGolay(X = spc_raw, m = 0, p = 3, w = 9)". Optional argument. Default is NULL.