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

Description Usage Arguments Details Value Author(s) Examples

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

1
2
## S4 method for signature '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

Details

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

Value

An object of the same class as obj

Author(s)

Pierre Roudier pierre.roudier@gmail.com

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# 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)

spectacles documentation built on Jan. 13, 2021, 8:46 a.m.