Learn R Programming

photobiology (version 0.10.6)

valleys: Valleys or local minima

Description

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

Usage

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

# S3 method for default valleys(x, span = NA, ignore_threshold = NA, strict = NA, na.rm = FALSE, ...)

# S3 method for default valleys(x, span = NA, ignore_threshold = NA, strict = NA, na.rm = FALSE, ...)

# S3 method for numeric valleys(x, span = 5, ignore_threshold, strict = TRUE, na.rm = FALSE, ...)

# S3 method for data.frame valleys( x, span = 5, ignore_threshold = 0, strict = TRUE, na.rm = FALSE, x.var.name = NULL, y.var.name = NULL, var.name = y.var.name, refine.wl = FALSE, method = "spline", ... )

# S3 method for generic_spct valleys( x, span = 5, ignore_threshold = 0, strict = TRUE, na.rm = FALSE, var.name = NULL, refine.wl = FALSE, method = "spline", ... )

# S3 method for source_spct valleys( x, span = 5, ignore_threshold = 0, strict = TRUE, na.rm = FALSE, unit.out = getOption("photobiology.radiation.unit", default = "energy"), refine.wl = FALSE, method = "spline", ... )

# S3 method for response_spct valleys( x, span = 5, ignore_threshold = 0, strict = TRUE, na.rm = FALSE, unit.out = getOption("photobiology.radiation.unit", default = "energy"), refine.wl = FALSE, method = "spline", ... )

# S3 method for filter_spct valleys( x, span = 5, ignore_threshold = 0, strict = TRUE, na.rm = FALSE, filter.qty = getOption("photobiology.filter.qty", default = "transmittance"), refine.wl = FALSE, method = "spline", ... )

# S3 method for reflector_spct valleys( x, span = 5, ignore_threshold = 0, strict = TRUE, na.rm = FALSE, refine.wl = FALSE, method = "spline", ... )

# S3 method for cps_spct valleys( x, span = 5, ignore_threshold = 0, strict = TRUE, na.rm = FALSE, refine.wl = FALSE, method = "spline", ... )

# S3 method for raw_spct valleys( x, span = 5, ignore_threshold = 0, strict = TRUE, na.rm = FALSE, var.name = "counts", refine.wl = FALSE, method = "spline", ... )

# S3 method for generic_mspct valleys( x, span = 5, ignore_threshold = 0, strict = TRUE, na.rm = FALSE, var.name = NULL, refine.wl = FALSE, method = "spline", ..., .parallel = FALSE, .paropts = NULL )

# S3 method for source_mspct valleys( x, span = 5, ignore_threshold = 0, strict = TRUE, na.rm = FALSE, unit.out = getOption("photobiology.radiation.unit", default = "energy"), refine.wl = FALSE, method = "spline", ..., .parallel = FALSE, .paropts = NULL )

# S3 method for response_mspct valleys( x, span = 5, ignore_threshold = 0, strict = TRUE, na.rm = FALSE, unit.out = getOption("photobiology.radiation.unit", default = "energy"), refine.wl = FALSE, method = "spline", ..., .parallel = FALSE, .paropts = NULL )

# S3 method for filter_mspct valleys( x, span = 5, ignore_threshold = 0, strict = TRUE, na.rm = FALSE, filter.qty = getOption("photobiology.filter.qty", default = "transmittance"), refine.wl = FALSE, method = "spline", ..., .parallel = FALSE, .paropts = NULL )

# S3 method for reflector_mspct valleys( x, span = 5, ignore_threshold = 0, strict = TRUE, na.rm = FALSE, refine.wl = FALSE, method = "spline", ..., .parallel = FALSE, .paropts = NULL )

# S3 method for cps_mspct valleys( x, span = 5, ignore_threshold = 0, strict = TRUE, na.rm = FALSE, var.name = "cps", refine.wl = FALSE, method = "spline", ..., .parallel = FALSE, .paropts = NULL )

# S3 method for raw_mspct valleys( x, span = 5, ignore_threshold = 0, strict = TRUE, na.rm = FALSE, var.name = "counts", refine.wl = FALSE, method = "spline", ..., .parallel = FALSE, .paropts = NULL )

Arguments

x

an R object

span

integer A valley is defined as an element in a sequence which is smaller than all other elements within a window of width span centered at that element. Use NULL for the global peak.

ignore_threshold

numeric Value between 0.0 and 1.0 indicating the relative size compared to tallest peak threshold below which peaks will be ignored. Negative values set a threshold so that the tallest peaks are ignored, instead of the shortest.

strict

logical If TRUE, an element must be strictly greater than all other values in its window to be considered a peak.

...

ignored

na.rm

logical indicating whether NA values should be stripped before searching for peaks.

var.name, x.var.name, y.var.name

character Name of column where to look for valleys.

refine.wl

logical Flag indicating if valley location should be refined by fitting a function.

method

character String with the name of a method. Currently only spline interpolation is implemented.

unit.out

character One of "energy" or "photon"

filter.qty

character One of "transmittance" or "absorbance"

.parallel

if TRUE, apply function in parallel, using parallel backend provided by foreach

.paropts

a list of additional options passed into the foreach function when parallel computation is enabled. This is important if (for example) your code relies on external data or packages: use the .export and .packages arguments to supply them so that all cluster nodes have the correct environment set up for computing.

Value

A subset of x with rows corresponding to local minima.

Methods (by class)

  • default: Default function usable on numeric vectors.

  • default: Default returning always NA.

  • numeric: Default function usable on numeric vectors.

  • data.frame: Method for "data.frame" objects.

  • 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".

  • cps_spct: Method for "cps_spct" objects.

  • raw_spct: Method for "raw_spct" objects.

  • generic_mspct: Method for "generic_mspct" objects.

  • source_mspct: Method for "source_mspct" objects.

  • response_mspct: Method for "cps_mspct" objects.

  • filter_mspct: Method for "filter_mspct" objects.

  • reflector_mspct: Method for "reflector_mspct" objects.

  • cps_mspct: Method for "cps_mspct" objects.

  • raw_mspct: Method for "raw_mspct" objects.

See Also

Other peaks and valleys functions: find_peaks(), find_spikes(), get_peaks(), peaks(), replace_bad_pixs(), spikes(), wls_at_target()

Examples

Run this code
# NOT RUN {
valleys(sun.spct, span = 50)

valleys(sun.spct)

# }

Run the code above in your browser using DataLab