method: bin creation rule. "strict" creates bins never containing two or more peaks of the same sample. "relaxed" allows multiple peaks of the same sample in one bin. "reference" generates bins around the mass values from the first MassPeaks object in l.
tolerance: double, maximal relative deviation of a peak position (mass) to be considered as identical. Must be multiplied by 10^-6 for ppm, e.g. use tolerance=5e-6 for 5 ppm.
Details
The algorithm is based on the following workflow:
Put all mass in a sorted vector.
Calculate differences between each neighbor.
Divide the mass vector at the largest gap (largest difference) and form a left and a right bin.
Rerun step 3 for the left and/or the right bin if they don't fulfill the following criteria:
All peaks in a bin are near to the mean (method == "strict"
or method == "relaxed") (abs(mass-meanMass)/meanMass \\< tolerance) or the reference mass (method == "reference"; abs(mass-reference)/reference \\< tolerance).
method == "strict": The bin doesn't contain two or more peaks of the same sample.
method == "strict": The new peak positions (mass value) are the mean mass of a bin.
method == "relaxed": The new peak positions for the highest peaks of each sample in a bin are generated by the mean mass of this peaks. The lower peaks are not changed. method == "reference": The new peak positions for the highest peaks of each sample in a bin are generated by the mass of peaks of the first MassPeaks object. Lower peaks are not changed.
Returns
Returns a list of mass adjusted MassPeaks objects.