navMS {MSnbase} | R Documentation

## Navigate an `MSnExp` object

### Description

Navigate an `MSnExp` object by moving to the next or previous spectrum.

### Usage

    navMS(i, object, msLevel, nav = c("nextMS", "prevMS"), ...)

    nextMS(...)

    prevMS(...)

### Arguments

`i` | The name or index of the current spectrum
`object` | The `MSnExp` object
`msLevel` | The MS level of the next or previous spectrum. If missing (default), then the level of the current spectrum is used.
`nav` | One of `"nextMS"` or `"prevMS"`, to obtain the next or previous spectrum of level `msLevel`.
`...` | Additional parameters. Currently ignored.

### Value

An object of class `Spectrum1` or `Spectrum2`, depending on the value of `msLevel` or `NULL`, of no spectrum is found.

### Author(s)

Laurent Gatto

### Examples

    f <- msdata::proteomics(full.names = TRUE, pattern = "MS3")
    x <- readMSData(f, centroided. = c(FALSE, TRUE, FALSE), mode = "onDisk")
    (sp <- which(msLevel(x) == 3)[2]) ## 2nd MS3 spectrum
    x[[sp]] ## curent MS3
    MSnbase:::nextMS(sp, x) ## next MS3
    MSnbase:::prevMS(sp, x) ## prev MS3
    MSnbase:::prevMS(sp, x, 2L) ## prev MS2
    MSnbase:::prevMS(sp, x, 1L) ## prev MS1

[Package MSnbase version 2.12.0 Index]