Learn R Programming

hsdar (version 0.5.1)

spectra: Handling spectra

Description

Returning and setting spectra in Speclib

Usage

"spectra"(object, i, j, ...)
"spectra"(object) <- value
"spectra"(object) <- value
"spectra"(object) <- value
"spectra"(object) <- value

Arguments

object
Object of class Speclib.
i
Index of spectra to return. If missing all spectra are returned.
j
Index of bands to return. If missing all bands are returned.
...
Passed to internal function. Currently only one parameter is accepted: return_names: Logical indicating, if names of columns and rows should be set to bandnames and idSpeclib.
value
Matrix or RasterBrick-object containing spectral values. If value is a matrix, columns are band values and rows are spectra.

Value

For spectra<-, the updated object. Otherwise a matrix of the spectra in x is returned.

Details

For spectra<-, the function does not check if dimensions of spectra match dimensions of Speclib. Additionally, no conversion into matrix is performed! If spectra are not correctly stored, errors in other functions may arise. Thus check always carefully, if spectra are modified by hand.

See Also

Speclib

Examples

Run this code
data(spectral_data)

## Manual plot of the first spectrum
plot(wavelength(spectral_data), spectra(spectral_data)[1,], type="l")

Run the code above in your browser using DataLab