R: Smooth a spectrum

smooth_spct {photobiology} | R Documentation

## Smooth a spectrum

### Description

These functions implement one original methods and acts as a wrapper for other common R smoothing functions. The advantage of using this function for smoothing spectral objects is that it simplifies the user interface and sets, when needed, defaults suitable for spectral data.

### Usage

    smooth_spct(x, method, strength, ...)

    ## Default S3 method:
    smooth_spct(x, method, strength, ...)

    ## S3 method for class 'source_spct'
    smooth_spct(x, method = "custom", strength = 1, ...)

    ## S3 method for class 'filter_spct'
    smooth_spct(x, method = "custom", strength = 1, ...)

    ## S3 method for class 'reflector_spct'
    smooth_spct(x, method = "custom", strength = 1,
      ...)

    ## S3 method for class 'response_spct'
    smooth_spct(x, method = "custom", strength = 1, ...)

### Arguments

`x` | an R object.
`method` | a character string "custom", "lowess", "supsmu".
`strength` | numeric value to adjust the degree of smoothing.
`...` | other parameters passed to the underlying smoothing functions.

### Value

A copy of `x` with spectral data values replaced by smoothed ones.

### Methods (by class)

- `default`: Default for generic function

- `source_spct`: Smooth a source spectrum

- `filter_spct`: Smooth a filter spectrum

- `reflector_spct`: Smooth a reflector spectrum

- `response_spct`: Smooth a response spectrum

### Note

Method "custom" is our home-brewed method which applies strong smoothing to low signal regions of the spectral data, and weaker or no smoothing to the high signal areas. Values very close to zero are set to zero with a limit which depends on the local variation. This method is an ad-hock method suitable for smoothing spectral data obtained with spectrometers. In the cased of methods "lowess" and "supsmu" the current function behaves like a wrapper of the functions of the same names from base R.

[Package photobiology version 0.9.21 Index]