wavelength: Retrieve Wavelength Information from Spectra Objects

wavelengthR Documentation

Retrieve Wavelength Information from Spectra Objects

Description

This function extracts the wavelength information from various representations of spectra. It supports the S4 class Spectra, as well as data.frame and matrix representations.

Usage

wavelength(object, ...)

## S4 method for signature 'Spectra'
wavelength(object, ...)

## S4 method for signature 'data.frame'
wavelength(object, ...)

## S4 method for signature 'matrix'
wavelength(object, ...)

Arguments

object

An object containing spectra data. This can be an S4 object of class Spectra, a data.frame, or a matrix.

...

Additional arguments for future extensions (currently not used).

Details

For an object of class Spectra, the method returns the value stored in the wavelength slot. For a data.frame or matrix, it extracts numeric values from the column names (by removing non-digit characters) of the spectra data.

Value

A numeric vector representing the wavelength information extracted from the object.

Examples

## Not run: 
  library(visa)

  # For an S4 Spectra object
  wavelengths <- wavelength(NSpec.Lib)

  # For spectra stored in a data.frame
  wavelengths <- wavelength(NSpec.DF)

  # For spectra stored in a matrix
  wavelengths <- wavelength(spectra_matrix)

## End(Not run)


visa documentation built on April 4, 2025, 5:40 a.m.