Learn R Programming

photobiology (version 0.9.6)

peaks: Peaks or local maxima

Description

Function that returns a subset of an R object with observations corresponding to local maxima.

Usage

peaks(x, span, ignore_threshold, strict, ...)

## S3 method for class 'default':
peaks(x, span, ignore_threshold, strict, ...)

## S3 method for class 'numeric':
peaks(x, span = 5, ignore_threshold, strict = TRUE, ...)

## S3 method for class 'generic_spct':
peaks(x, span, ignore_threshold, strict, ...)

## S3 method for class 'source_spct':
peaks(x, span = 5, ignore_threshold = 0,
  strict = TRUE, unit.out = getOption("photobiology.radiation.unit", default
  = "energy"), ...)

## S3 method for class 'response_spct':
peaks(x, span = 5, ignore_threshold = 0,
  strict = TRUE, unit.out = getOption("photobiology.radiation.unit", default
  = "energy"), ...)

## S3 method for class 'filter_spct':
peaks(x, span = 5, ignore_threshold = 0,
  strict = TRUE, filter.qty = getOption("photobiology.filter.qty", default =
  "transmittance"), ...)

## S3 method for class 'reflector_spct':
peaks(x, span = 5, ignore_threshold = 0,
  strict = TRUE, ...)

## S3 method for class 'cps_spct':
peaks(x, span = 5, ignore_threshold = 0, strict = TRUE,
  ...)

## S3 method for class 'generic_mspct':
peaks(x, span = 5, ignore_threshold = 0,
  strict = TRUE, ...)

Arguments

x
an R object
span
a peak is defined as an element in a sequence which is greater than all other elements within a window of width span centered at that element. The default value is 3, meaning that a peak is bigger than both of its neighbors. Default: 3.
ignore_threshold
numeric value between 0.0 and 1.0 indicating the relative size compared to talelst peakthreshold below which peaks will be ignored.
strict
logical flag: if TRUE, an element must be strictly greater than all other values in its window to be considered a peak. Default: TRUE.
...
ignored
unit.out
character One of "energy" or "photon"
filter.qty
character One of "transmittance" or "absorbance"

Value

  • a subset of x with rows corresponding to local maxima.

Methods (by class)

  • default: Default function usable on numeric vectors.
  • numeric: Default function usable on numeric vectors.
  • generic_spct: Method for "generic_spct" objects.
  • source_spct: Method for "source_spct" objects.
  • response_spct: Method for "response_spct" objects.
  • filter_spct: Method for "filter_spct" objects.
  • reflector_spct: Method for "reflector_spct" objects.
  • cps_spct: Method for "cps_spct" objects.
  • generic_mspct: Method for "cps_spct" objects.

See Also

Other peaks and valleys functions: find_peaks, get_peaks, valleys

Examples

Run this code
peaks(sun.spct)

Run the code above in your browser using DataLab