photobiology (version 0.9.26)

smooth_spct: 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, ...)

# S3 method for default smooth_spct(x, method, strength, ...)

# S3 method for source_spct smooth_spct(x, method = "custom", strength = 1, na.rm = FALSE, ...)

# S3 method for filter_spct smooth_spct(x, method = "custom", strength = 1, na.rm = FALSE, ...)

# S3 method for reflector_spct smooth_spct(x, method = "custom", strength = 1, na.rm = FALSE, ...)

# S3 method for response_spct smooth_spct(x, method = "custom", strength = 1, na.rm = FALSE, ...)

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.

na.rm

logical A value indicating whether NA values should be stripped before the computation proceeds.

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

Examples

Run this code
# NOT RUN {
my.spct <- clip_wl(sun.spct, c(400, 500))
smooth_spct(my.spct)
smooth_spct(my.spct, method = "supsmu", strength = 4)

# }

Run the code above in your browser using DataLab