Learn R Programming

alkahest (version 1.3.0)

baseline_linear: Linear Baseline Estimation

Description

Linear Baseline Estimation

Usage

baseline_linear(x, y, ...)

# S4 method for numeric,numeric baseline_linear(x, y, points = range(x))

# S4 method for ANY,missing baseline_linear(x, points = range(x))

Value

Returns a list with two components x and y.

Arguments

x, y

A numeric vector. If y is missing, an attempt is made to interpret x in a suitable way (see grDevices::xy.coords()).

...

Currently not used.

points

A numeric vector specifying the data points to be used in the fitting process (in x unit).

Author

N. Frerebeau

See Also

signal_correct()

Other baseline estimation methods: baseline_asls(), baseline_peakfilling(), baseline_polynomial(), baseline_rollingball(), baseline_rubberband(), baseline_snip()

Examples

Run this code
## X-ray diffraction
data("XRD")

## Plot spectrum
plot(XRD, type = "l", xlab = expression(2*theta), ylab = "Count")

## Linear baseline
baseline <- baseline_linear(XRD, points = c(25, 34))

plot(XRD, type = "l", xlab = expression(2*theta), ylab = "Count")
lines(baseline, type = "l", col = "red")

## Correct baseline
XRD$count <- XRD$count - baseline$y

plot(XRD, type = "l", xlab = expression(2*theta), ylab = "Count")

Run the code above in your browser using DataLab