Equidistant binning of spectra by summarising intensities within ppm bins.
Arguments
- X
Numeric matrix or data frame with spectra in rows, or a named list as returned by
read1d/read1d_proccontainingXandppm.- ppm
Numeric vector of chemical shift positions (length must match
ncol(X)). IfNULL,ppmis inferred in the following order:X$ppmifXis a list input,attr(X, "m8_axis")$ppm(if present),numeric
colnames(X)(if present).
- width
Numeric. Bin size in ppm, or
NULLifnpointsis specified.- npoints
Integer. Desired number of bins per spectrum, or
NULLifwidthis specified. If both are provided,npointsis used.- fun
Function. Summary function applied to intensities within each bin. Must return a single numeric value (e.g.
sum,mean,max).
Details
If present, preprocessing provenance is appended to attr(X, "m8_prep") using
.m8_stamp(). The ppm axis is updated in attr(X, "m8_axis")$ppm and
column names are set to the bin centres.
When width is specified, spectra are interpolated onto a regular ppm grid and
then aggregated within bins (interp = TRUE in provenance). When npoints
is specified, aggregation is performed by index bins on the original grid
(interp = FALSE in provenance).
See also
Other preprocessing:
align_segment(),
align_spectra(),
calibrate(),
correct_baseline(),
correct_lw(),
pqn(),
print_preprocessing()