The function can be applied to spectral collections, dt_prep_sets. The list-column id_labels with lists of data.tables each containing a column named group must be present. See also ids_apply().

colmean_group_apply(dt_prep_sets, append_rows = FALSE)

Arguments

dt_prep_sets

A standardized data.table, i.e. returned from specprepper::*_apply() function. Contains labelled sets of preprocessed spectra: This argument allows to chain preprocessing in sequential manner, and i.e. apply variable Savitzky-Golay smoothers with a single function application.

append_rows

logical whether to append the newly processed rows, when dt_prep_sets is not NULL.

Value

  • A "data.table" with as many rows as spectral collections. It contains at least the following columns:

    • prep_set: appends "-mean_group" to the exisiting character vector elements of the input data.

    • prep_label: appends "mean_group" to the exisiting character vector elements of the input data.

    • prep_params: A list-column with 1-row data.table's. Each data.table has a new column mean_group, contains the string "id_labels$group".

    • id_labels: This list-column now only contains a sliced version of the group column, that correspond to the new rows of the aggregated column means in spc_prep.

    • spc_prep: A list-column with data.tables that contain aggregated means of spectra by group for each spectral collection (row of dt_prep_sets)

Details

A spectral collection typically represents an outcome of one or more specific preprocessing with methods and possibly associated parameters used. colmean_group_apply() only accepts collections with structural conventions of dt_prep_sets. It requires a id_labels list-column with a group column specifying the lables used for aggregation in each data.table element (one for each collection). Label columns such as row or id that were present before will be removed because they are assumed to be aggregated.