Learn R Programming

spectacles (version 0.5-4)

cut: Manipulating the wavelength range of a Spectra object

Description

This methods allows to either select or remove a specific range of wavelengths from a Spectra object.

Usage

# S4 method for Spectra
cut(x, ..., wl)

Value

An object of the same class as x.

Arguments

x

an object inheriting from class Spectra

...

ignored

wl

a vector of the wavelengths to either select or remove from x

Author

Pierre Roudier pierre.roudier@gmail.com

Details

The wavelengths are extracted if wl > 0, or removed if wl < 0. You can't mix negative and positive index in wl.

Examples

Run this code

# Loading example data
data(australia)
spectra(australia) <- sr_no ~ ... ~ 350:2500

# Extracting a specific wavelengths range
s <- cut(australia, wl = 450:550)
plot(s)

s <- cut(australia, wl = c(450:550, 1850:2050))
plot(s)

# Removing a specific wavelengths range
s <- cut(australia, wl = -1*450:550)
plot(s)

s <- cut(australia, wl = -1*c(450:550, 1850:2050))
plot(s)

Run the code above in your browser using DataLab