Usage
binning(X, ppm, width = NULL, npoints = NULL)
Arguments
- X
num matrix, NMR data with spectra in rows
- ppm
num array, chemical shift positions, length matches to columns in X
- width
num, bin size in ppm or NULL in case npoints
is specified
- npoints
num, desired number of bins per spectrum or NULL in case width
is specified
Value
Numeric matrix with spectra in rows and chemical shift variables in columns.
Details
Equidistant binning of spectra. Specify either width
or npoints
argument - if both are provided, npoints
is used. Input argument ppm
can be omitted if chemical shift information is encoded in the column names of the NMR matrix X
.
See also
Other NMR:
alignSegment()
,
cvanova()
,
get_idx()
,
lw()
,
matspec()
,
noise.est()
,
normErectic()
,
read1d()
,
read1d_raw()
,
stocsy1d_metabom8-class
,
storm()
Examples
# Simulate 2 spectra with 100 ppm points
set.seed(1)
X <- matrix(rnorm(2 * 100), nrow = 2)
ppm <- round(seq(10, 0.5, length.out = 100), 3)
colnames(X) <- ppm
# Bin using width of 0.5 ppm
Xb <- binning(X, ppm, width = 0.5)
# Show dimensions of binned data
dim(Xb)
#> [1] 2 19