| msDetrend {msProcess} | R Documentation |
Estimate and subsequently subtract the baselines from mass spectra. The basic technique for baseline estimation is to fit a curve locally to the intensity minima.
msDetrend(x, FUN="loess",
attach.base=TRUE,
event="Baseline Correction", ...)
x |
An object of class msSet. |
... |
Additional arguments for the FUN specified.
See the specific underlying function for details. |
FUN |
Either an object of class "character"
or of class "function".
character: A character string denoting the method to use in smoothing the data to estimate the baseline. Supported choices are
Default: "loess".
function: A user-defined function with an argument list of the form (x, ...) where x is a required argument
corresponding to a numeric vector (typically these values
will be the noise estimates of a mass spectrum).
In either case, the additional arguments ... will be
passed directly to the specified routine. |
attach.base |
A logical value specifying if the estimated baseline needs to be attached
as an element to the output, and the default is T.
It has to be T if you want to visualize the baseline. |
event |
A character string denoting the name of the
event to register with the (embedded) event history object of the input
after processing the input data. Default: "Baseline Correction". |
An object of class msSet,
optionally, with the estimated baseline attached as element
"baseline".
If FUN="mrd", an mrd object containing meta information regarding
the multiresolution decomposition is attached to the msSet output object for subsequent
use by other MRD-based function calls such as msPeak(x, FUN="mrd", ...).
msSmoothLoess, msSmoothSpline, msSmoothSupsmu, msSmoothApprox, msSmoothMonotone, msSmoothMRD.
if (!exists("qcset")) data("qcset", package="msProcess")
## extract several spectra from the build-in
## dataset
z <- qcset[, 1:8]
## denoising
z <- msDenoise(z, FUN="wavelet", n.level=10, thresh.scale=2)
## baseline subtraction
z <- msDetrend(z, FUN="monotone", attach=TRUE)
## visualize the baseline
plot(z, process="msDetrend", subset=1:3,
xlim=c(5000, 8500), lty=1, lwd=c(1,3))