spectrace_classify_clusters: Classify aggregated spectra

View source: R/spectrace_classify_clusters.R

spectrace_classify_clustersR Documentation

Classify aggregated spectra

Description

This function classifies (groups) of spectra by first aggregating the data and then correlating the aggregated spectra to reference spectra, identifying the best matching reference spectra.

Usage

spectrace_classify_clusters(
  lightData,
  referenceData = NULL,
  aggregation = c("median", "mean"),
  method = c("correlation"),
  n.classes = 5,
  return.spectra = TRUE
)

Arguments

lightData

(Grouped) data frame containing the (calibrated) light data. Data needs to be in wide format (see spectrace_to_wide). Classification will be performed on the aggregated data (e.g. median) per group.

referenceData

(Optional) data frame containing the reference spectra. Needs to contain the same wavelength columns as 'lightData'. Must consist of unique spectra and must contain a column named 'spectrum_id' identifying each spectrum. If not provided, the in-built reference spectra are used (see spectrace_reference_spectra).

aggregation

Aggregation method. Must be one of ['median', 'mean']. Defaults to 'median'.

method

Classification method. Must be one of ['correlation']. Defaults to 'correlation'.

n.classes

Integer indicating the number of predicted classes per group to include in the output. Defaults to 5.

Value

A data frame with the best 'n.classes' classifications (i.e. the 'spectrum_id') and corresponding coefficients per group.


steffenhartmeyer/spectrace documentation built on Dec. 4, 2024, 4:13 p.m.