wl {hyperSpec}R Documentation

Getting and Setting the Wavelength Axis

Description

wl returns the wavelength axis, wl<- sets it.

Arguments

x a hyperSpec object
value either a numeric containing the new wavelength vector, or a list with value$wl containing the new wavelength vector and value$label holding the corresponding label.
label The label for the new wavelength axis. See initialize for details.
digits handed to signif. See details.
short, user, date handed to logentry.

Details

The wavelength axis of a hyperSpec object can be retrieved and replaced with wl and wl<-, respectively.

When the wavelength axis is replaced, the colnames of x@data$spc are replaced by the rounded new wavelengths. digits specifies the how many significant digits should be used.

There are two ways to set the label of the new wavelength axis, see the examples. If no label is given, a warning will be issued.

Value

for wl a numeric vector, for wl<- a hyperSpec object.

Usage

wl (x)

## Replacement method

wl (x, label) <- value

wl (x) <- list (wl = value, label = label)

wl (x, label = NULL, digits = 6, short = "wl<-", user = NULL, date = NULL) <- value

`wl<-` (x, label = NULL, digits = 6, short = "wl<-", user = NULL, date = NULL, value)

Note

wl<- always sets the complete wavelength axis, without changing the columns of the spectra matrix. If you rather want to cut the spectral range, use [, for interpolation along the spectral axis see spc.loess and for spectral binning spc.bin.

Author(s)

C. Beleites

See Also

signif

cutting the spectral range: [

interpolation along the spectral axis: spc.loess

spectral binning: spc.bin

Examples

        wl (laser)
        
        # convert from wavelength to frequency 
        plot (laser)
        wl (laser, "f / Hz") <- 2.998e8 * wl (laser) * 1e9
        plot (laser)
        
        # convert from Raman shift to wavelength
        # excitation was at 785 nm
        plot (chondro [1])
        wl (chondro) <- list (wl = 1e7 / (1e7/785 - wl (chondro)), label = expression (lambda / nm))
        plot (chondro [1])

[Package hyperSpec version 0.95 Index]