-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create a sequence of values with increasing differences between values #121
Conversation
- Add function `breaks_ppm` to calculate a sequence of values with increasing difference between value pairs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I have a small suggestion.
R/binning.R
Outdated
#' ## difference between the values increases (by ppm) | ||
#' diff(res) | ||
breaks_ppm <- function(from = 1, to = 1, by = 1, ppm = 0) { | ||
## Maybe implement in C for higher performance. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would remove this comment. We can do it later if this function is really a bottle neck. But I assume it wouldn't be called very often.
Co-authored-by: Sebastian Gibb <[email protected]>
@jorainer I already merged this PR but a version bump and NEWS.md entry are missing. Could you add these please? |
Sure - hm, also strange that I did not include that... |
This PR adds a simple function
breaks_ppm
that calculates a sequence of values with increasing difference between pairs of values. This is in contrast toseq
that creates a sequence of values with a constant difference between values.A use case of this function would be e.g. for binning of peaks in mass spectra with bin sizes that increase with the m/z. The current default (that simply uses
seq
and thus a constant bin size) does not properly account for m/z dependent errors of (TOF) MS instruments.I'm not super-happy with the name of the function (
breaks_ppm
), thus, happy for suggestions. Also, the function could also (easily) be implemented in C to improve performance.