Learn R Programming

hsdar (version 0.5.1)

specfeat: Function to isolate spectral features

Description

Function isolates specified absorption features previously identified by define.features.

Usage

specfeat(x, FWL)
"plot"(x, fnumber = 1, stylebysubset = NULL, changecol = TRUE, changetype = FALSE, autolegend = TRUE, new = TRUE, ...)

Arguments

x
Object of class Speclib containing the band depth or ratio transformed reflectance spectra with additional information on feature limits calculated by define.features. For plot this must be object of class specfeat.
FWL
A vector containing one wavelength per feature to be isolated, e.g. the major absorption features. Features which include these specified wavelengths will be isolated.
fnumber
Index of feature(s) to be plotted.
stylebysubset
Name of variable to be used as grouping factor. May be selected from attributes table, groups or subgroups and must be convertible to factors.
changecol
Flag, if line colour should be varied among groups
changetype
Flag, if line styles should be varied among groups
autolegend
Flag if, legend is printed automatically.
new
Create new plot or add data to existing one.
...
Further arguments passed to plot function.

Value

An object of class Specfeat containing the isolated features.

See Also

define.features, cut_specfeat, Specfeat

Examples

Run this code

data(spectral_data)

## Transform speclib
bd <- transformSpeclib(spectral_data, method = "sh", out = "bd")

## Define features automatically
features <- define.features(bd)

##Example to isolate the features around 450nm, 700nm, 1200nm and 1500nm.
featureSelection <- specfeat(features, c(450,700,1200,1500))

## Plot features
plot(featureSelection, 1:4)

## Advanced plotting example
plot(featureSelection, 1:4, stylebysubset = "season")

plot(featureSelection, 1:4, stylebysubset = "season", changecol = FALSE, 
     changetype = TRUE)

Run the code above in your browser using DataLab