Split xcmsRaw objects
You might have a file measured with complex MS2 of different precursor masses possibly even with different collision energies. Now you want to separate those into individual xcmsRaw objects, based on the MS2 parameters.
library(xcms)
library(msdata)
filename <- system.file('iontrap/extracted.mzData', package = "msdata")
x1 <- xcmsRaw(filename, includeMSn=TRUE)
## Catenate the (nominal) precursor mass and collision energy
index <- paste(round(x1@msnPrecursorMz),x1@msnCollisionEnergy, sep="@")
## and split x1 into multiple xraws with data in the "normal" MS1 slots
xraws <- split(x1, f=index)
## Access the resulting data:
names(xraws)
xraws[["672@35"]]