spectacles (version 0.5-0)

fill_spectra: Fill missing wavelengths of a Spectra* object with a given value

Description

Fill missing wavelengths of a Spectra* object with a given value. This is mostly usefull to include NA values in the spectra in order to show missing bits in plots.

Usage

# S4 method for Spectra
fill_spectra(obj, ref = NULL, fill = NA, ...)

Arguments

obj

an object inheriting from class Spectra

ref

a numeric vector, giving the reference wavelengths (ie the entire range of wavelengths expected to be in the spectra before some waveleng5ths have been cut out). If NULL, the function is trying to guess it.

fill

values to fill gaps in the data with

...

ignored

Value

An object of the same class as obj

Details

At this stage removing gaps does not work well with irreguarly spaced wavelengths. Results might be odd for binned spectra.

Examples

Run this code
# NOT RUN {
# Loading example data
data(australia)
spectra(australia) <- sr_no ~ ... ~ 350:2500

# Cut wavelengths out of the collection
oz <- cut(australia, wl=-1*c(355:400, 2480:2499))
big.head(spectra(oz), , 7)

# Giving the wavelengths at which I want data
oz_filled <- fill_spectra(oz, ref = 350:2500, fill = NA)
big.head(spectra(oz_filled), , 7)
plot(oz_filled)

# Trying to guess ref values
oz_filled <- fill_spectra(oz, fill = -999)
big.head(spectra(oz_filled), , 7)
plot(oz_filled)

# }

Run the code above in your browser using DataCamp Workspace