Description Usage Arguments Value Author(s) Examples
View source: R/mass-utility-functions.R
Match numeric values in x
against values in y
and return indices of
all matches of x
in y
allowing differences between the values
specified with parameter ppm
(part per million).
1 | matchWithPpm(x, y, ppm = 0)
|
x |
|
y |
|
ppm |
|
list
with integer
representing the index in y
where each
element in x
matches (given the provided ppm).
Johannes Rainer
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | yvals <- abs(rnorm(1000))
yvals[123] <- yvals[2] - yvals[2] * 10 * 1e-6
yvals[124] <- yvals[2] + yvals[2] * 10 * 1e-6
yvals[125] <- yvals[2] + yvals[2] * 12 * 1e-6
xvals <- yvals[c(2, 3, 3, 20, 21, 20)]
xvals[2] <- xvals[2] + (10 * xvals[2] / 1e6)
xvals[3] <- xvals[3] - (10 * xvals[3] / 1e6)
xvals[6] <- xvals[6] + (12 * xvals[6] / 1e6)
## Perfect matches:
matchWithPpm(xvals, yvals)
## Match allowing +/- 10ppm difference
matchWithPpm(xvals, yvals, ppm = 10)
## Match allowing +/- 20ppm difference
matchWithPpm(xvals, yvals, ppm = 20)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.