Add a function scalePeaks to scale intensities of all peaks within each spectrum either by the max intensity or the sum of intensities. The definition of the function could be:
scalePeaks <- function(x, msLevel = seq_len(4), by = sum, ...)
Parameter by could be the function to calculate the intensity by which individual intensities will be scaled. sum would mean all intensities get scaled by the sum of intensities within a spectrum (i.e. intensity <- intensity / sum(intensity).
Instead of calling the function scaleSpectra I would suggest to call it scalePeaks to make clear that peaks within spectra a scaled.
Add a function
scalePeaks
to scale intensities of all peaks within each spectrum either by the max intensity or the sum of intensities. The definition of the function could be:Parameter
by
could be the function to calculate the intensity by which individual intensities will be scaled.sum
would mean all intensities get scaled by the sum of intensities within a spectrum (i.e.intensity <- intensity / sum(intensity)
.Instead of calling the function
scaleSpectra
I would suggest to call itscalePeaks
to make clear that peaks within spectra a scaled.