Skip to content
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

difference_right_join does not create distance_col when there are no overlapping rows #57

Closed
dewoller opened this issue Aug 5, 2019 · 1 comment

Comments

@dewoller
Copy link

dewoller commented Aug 5, 2019

difference_right_join (and probably others) do not create the designated distance_col when there are no overlapping rows. This makes use of these functions in a general pipeline problematic because the column you expect to exist does not. Example below

library(fuzzyjoin)
a <- data.frame(replicate(2,sample(20:30,10,rep=TRUE))) 

b <- data.frame(replicate(2,sample(1:10,10,rep=TRUE))) 

difference_right_join( a, b, by='X1', max_dist = 1, distance_col='distance')
#>    X1.x X2.x X1.y X2.y
#> 1    NA   NA   10    4
#> 2    NA   NA    7    5
#> 3    NA   NA    9    2
#> 4    NA   NA    1   10
#> 5    NA   NA    8    4
#> 6    NA   NA    5    1
#> 7    NA   NA    4    9
#> 8    NA   NA    1    3
#> 9    NA   NA    9    5
#> 10   NA   NA    3    6

Created on 2019-08-05 by the reprex package (v0.3.0)

@dgrtwo dgrtwo closed this as completed in 2925ba6 Aug 5, 2019
@dgrtwo
Copy link
Owner

dgrtwo commented Aug 5, 2019

Thanks for this find, this is now fixed and relevant unit tests added! Please try it out and let me know if it doesn't fit your expectations.

I expect this to be submitted to CRAN sometime this week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants