R/topIons.R

Defines functions topIons

Documented in topIons

topIons <-
function(mz, intensity, top){
  if(length(mz)!=length(intensity)) stop("Wrong Spectrum! num of mz and intensity should be equal");
  if(length(mz) < top) top=length(mz);
  y=sort(intensity, decreasing=TRUE, index.return=TRUE);
  intensity=y$x[1:top];
  mz=mz[y$ix[1:top]];

  cbind(sort(mz), intensity[order(mz)]);
}#>>>

Try the iontree package in your browser

Any scripts or data that you put into this service are public.

iontree documentation built on May 2, 2018, 2:55 a.m.