In ChemoSpec, spectral data sets are stored in an S3 class called Spectra, which contains a variety of information in addition to the spectra themselves. Spectra objects are created by files2SpectraObject or matrix2SpectraObject.


The structure of a Spectra object is a list of 9 elements and an attribute as follows:

$freqnumA common frequency (or wavelength) axis for all the spectra.
$datanumThe intensities for the spectra. A matrix of dimension
no. samples x no. frequency points.
$nameschrThe sample names for the spectra; length must be no. samples.
$groupsFactorThe group classification of the samples; length must be no. samples.
$colorschrThe colors for each sample; length must be no. samples.
Groups and colors correspond.
$symintegerAs for colors, but symbols for plotting (if b/w is desired).
$alt.symchrLower-case letters as alternate symbols for plotting.
$unitchrTwo entries, the first giving the x axis unit, the second the y axis unit.
$descchrA character string describing the data set. This appears on plots and therefore
should probably be kept to 40 characters or less.
- attrchr "Spectra"The S3 class designation.

See also

sumSpectra to summarize a Spectra object. sumGroups to summarize group membership of a Spectra object. chkSpectra to verify the integrity of a Spectra object. colorSymbol for a discussion of color options. Finally, additional documentation at


Bryan A. Hanson (DePauw University)