Bin 'MSnExp' or 'Spectrum' instances
bin-methods.RdThis method aggregates individual spectra (Spectrum instances)
or whole experiments (MSnExp instances) into discrete bins. All
intensity values which belong to the same bin are summed together.
Methods
signature(object = "MSnExp", binSize = "numeric", verbose = "logical")Bins all spectra in an
MSnExpobject. UsebinSizeto control the size of a bin (in Dalton, default is1). Displays a control bar if verbose set toTRUE(default). Returns a binnedMSnExpinstance.signature(object = "Spectrum", binSize = "numeric", breaks = "numeric", msLevel. = "numeric")Bin the
Spectrumobject. UsebinSizeto control the size of a bin (in Dalton, default is1). Similar tohistyou could usebreaksto specify the breakpoints between m/z bins.msLevel.defines the level of the spectrum, and ifmsLevel(object) != msLevel., cleaning is ignored. Only relevant when called fromOnDiskMSnExpand is only relevant for developers.Returns a binned
Spectruminstance.
See also
clean, pickPeaks, smooth,
removePeaks and trimMz
for other spectra processing methods.
Examples
s <- new("Spectrum2", mz=1:10, intensity=1:10)
intensity(s)
#> [1] 1 2 3 4 5 6 7 8 9 10
intensity(bin(s, binSize=2))
#> [1] 3 7 11 15 19
data(itraqdata)
sum(peaksCount(itraqdata))
#> [1] 106289
itraqdata2 <- bin(itraqdata, binSize=2)
sum(peaksCount(itraqdata2))
#> [1] 54186
processingData(itraqdata2)
#> - - - Processing information - - -
#> Data loaded: Wed May 11 18:54:39 2011
#> Updated from version 0.3.0 to 0.3.1 [Fri Jul 8 20:23:25 2016]
#> Spectra binned: Tue Aug 26 11:38:01 2025
#> MSnbase version: 1.1.22