| rangemerge | R Documentation |
For each row of x, keep the row(s) of y whose value
column falls between x's lower and upper bounds
(inclusive), within the exact-match by key.
rangemerge(x, y, by, lower, upper, value)
x, y |
Data frames or data tables to join. |
by |
Character vector of exact-match join columns, present in both
|
lower, upper |
Single columns in |
value |
Single column in |
A basetable with one row per x row for each y row whose
value falls within [lower, upper] (matching on by); an
x row with no matching y row appears once with NA for
y's columns.
x <- data.frame(id = c(1, 1, 2), lower = c(0, 0, 0), upper = c(10, 10, 20))
y <- data.frame(id = c(1, 1, 2), val = c(5, 15, 5), label = c("a", "b", "c"))
rangemerge(x, y, by = "id", lower = "lower", upper = "upper", value = "val")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.