R: Join two tables based on absolute difference between their...

difference_join {fuzzyjoin} | R Documentation

## Join two tables based on absolute difference between their columns

### Description

Join two tables based on absolute difference between their columns

### Usage

    difference_join(x, y, by = NULL, max_dist = 1, mode = "inner",
      distance_col = NULL)

    difference_inner_join(x, y, by = NULL, max_dist = 1, distance_col = NULL)

    difference_left_join(x, y, by = NULL, max_dist = 1, distance_col = NULL)

    difference_right_join(x, y, by = NULL, max_dist = 1, distance_col = NULL)

    difference_full_join(x, y, by = NULL, max_dist = 1, distance_col = NULL)

    difference_semi_join(x, y, by = NULL, max_dist = 1, distance_col = NULL)

    difference_anti_join(x, y, by = NULL, max_dist = 1, distance_col = NULL)

### Arguments

`x` | A tbl
`y` | A tbl
`by` | Columns by which to join the two tables
`max_dist` | Maximum distance to use for joining
`mode` | One of "inner", "left", "right", "full" "semi", or "anti"
`distance_col` | If given, will add a column with this name containing the difference between the two

### Examples

    library(dplyr)

    head(iris)
    sepal_lengths <- data_frame(Sepal.Length = c(5, 6, 7), Type = 1:3)

    iris %>%
      difference_inner_join(sepal_lengths, max_dist = .5)

[Package fuzzyjoin version 0.1.4 Index]