View source: R/spectrace_classify_spectra.R
spectrace_classify_spectra | R Documentation |
This function classifies each spectrum (i.e. row) by encoding the spectra using PCA on the reference data and calculating the pairwise distance between the reference and measured spectra. The reference spectrum with the minimum distance to the measured spectrum is taken as the classification.
spectrace_classify_spectra(
lightData,
referenceData = NULL,
distance = c("euclidian"),
return.encoded = FALSE
)
lightData |
(Grouped) data frame containing the (calibrated) light data. Data needs
to be in wide format (see |
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
|
distance |
Distance metric to use. Options are: "euclidian" (default). |
return.encoded |
Logical. Add encoded principal components to data frame. Defaults to FALSE. |
The original data with a new column for the classification. If 'return.encoded' is TRUE then columns with the principal component loadings are added.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.