Learn R Programming

hyperSpec (version 0.95)

spc.identify: Identifying Spectra and Spectral Data Points

Description

This function allows to identify the spectrum and the wavelength of a point in a plot produced by plotspc.

Usage

spc.identify(x, y = NULL, wavelengths = NULL, ispc = NULL, ...)

Arguments

x
either the abscissa coordinates or the list returned by plotspc
y
the ordinate values. Giving y will override any values from x$y.
wavelengths
the wavelengths for the data points. Giving wavelengths will override any values from x$wavelengths.
ispc
if a selection of spectra was plotted, their indices can be given in ispc. In this case ispc [i] is returned rather than i.
...
passed to identify

Value

  • a data.frame with columns
  • ispectra indices of the identified points, i.e. the rows of the hyperSpec object that was plotted. If ispc is given, ispc [i] is returned rather than i.
  • wavelengthsthe wavelengths of the identified points

Details

The function uses identify to identify the points clicked at with the left button and converts them into a more convenient format.

See Also

identify, plotspc

Examples

Run this code
ispc <- sample (nrow (laser), 10)
ispc

identified <- spc.identify (plotspc (laser[ispc]))
## convert to the "real" spectra indices
ispc [identified$i]
identified$wavelength

spc.identify (plotspc (laser[ispc]), ispc = ispc)

Run the code above in your browser using DataLab