bin-methods {MSnbase} | R Documentation

## Bin 'MSnExp' or 'Spectrum' instances

### Description

This 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 `MSnExp` object. Use `binSize` to control the size of a bin (in Dalton, default is `1`). Displays a control bar if verbose set to `TRUE` (default). Returns a binned `MSnExp` instance.

`signature(object = "Spectrum", binSize = "numeric", breaks = "numeric", msLevel. = "numeric")`

  Bin the `Spectrum` object. Use `binSize` to control the size of a bin (in Dalton, default is `1`). Similar to `hist` you could use `breaks` to specify the breakpoints between m/z bins. `msLevel.` defines the level of the spectrum, and if `msLevel(object) != msLevel.`, cleaning is ignored. Only relevant when called from `OnDiskMSnExp` and is only relevant for developers.

  Returns a binned `Spectrum` instance.

### Author(s)

Sebastian Gibb <mail@sebastiangibb.de>

### 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)
    intensity(bin(s, binSize=2))

    data(itraqdata)
    sum(peaksCount(itraqdata))
    itraqdata2 <- bin(itraqdata, binSize=2)
    sum(peaksCount(itraqdata2))
    processingData(itraqdata2)

[Package MSnbase version 2.10.1 Index]