## Not run:
# library(xcms)
# library(faahKO)
# cdfpath <- system.file("cdf", package = "faahKO")
# cdffiles <- list.files(cdfpath, recursive = TRUE, full.names = TRUE)
# xr<-xcmsRaw(cdffiles[1])
# xr
# ##This gives some information about the file
# names(attributes(xr))
# ## Lets have a look at the structure of the object
#
# str(xr)
# ##same but with a preview of each slot in the object
# ##SO... lets have a look at how this works
# head(xr@scanindex)
# #[1] 0 429 860 1291 1718 2140
# xr@env$mz[425:430]
# #[1] 596.3 597.0 597.3 598.1 599.3 200.1
# ##We can see that the 429 index is the last mz of scan 1 therefore...
#
# mz.scan1<-xr@env$mz[(1+xr@scanindex[1]):xr@scanindex[2]]
# intensity.scan1<-xr@env$intensity[(1+xr@scanindex[1]):xr@scanindex[2]]
# plot(mz.scan1, intensity.scan1, type="h", main=paste("Scan 1 of file", basename(cdffiles[1]), sep=""))
# ##the easier way :p
# scan1<-getScan(xr, 1)
# head(scan1)
# plotScan(xr, 1)
# ## End(Not run)
Run the code above in your browser using DataLab