peak_maxima: Detect peak maxima

View source: R/peak_maxima.R

peak_maximaR Documentation

Detect peak maxima

Description

Detect peak maxima

Usage

peak_maxima(
  data,
  focus = 10,
  k = 35,
  peaks = 1,
  n = 1,
  method = "gam",
  max_iter = 20,
  group_vars = c("date", "sample", "param"),
  x_var = "time",
  y_var = "conc"
)

Arguments

data

A tibble returned by load_icp(), load_uv(), load_mals(), or combine_fff()

focus

Peaks occurring at x values less than or equal to this value are not considered. For FFF data, this is the focus period.

k

The basis dimension of the generalized additive model used to detect peak minima.

peaks

Number of peaks.

n

Before detecting peak minima, compute an n-point moving average of the detector response using stats::filter(x, filter = rep(1/n, n)).

method

Algorithm for peak detection. Either "gam", which separates peaks by the minima between them, or "sigma" which recursively calculates the standard deviation by eliminating values greater than three standard deviations. N.B., method = "sigma" silently removes NAs from x and y.

max_iter

Maximum iterations for method = "sigma".

group_vars

Grouping variables for input to dplyr::group_by().

x_var

Name of x variable.

y_var

Name of y variable.

Value

A tibble of peak retention times and the corresponding maxima in detector response.

Examples

path <- system.file("extdata", package = "fffprocessr")
data <- combine_fff(load_icp(path))
data <- data[data$param == "65Cu", ]
peak_maxima(data, peaks = 3)

bentrueman/fffprocessr documentation built on June 23, 2024, 1:23 a.m.