0

I am trying to left join using dplyr package in R.

Join_data <- left_join(df1, df2, by.x = c("Paid"),  by.y = c("Price"))

The error message says

Error in left_join_impl(x, y, by$x, by$y, suffix$x, suffix$y, check_na_matches(na_matches)) : 
  Can't join on 'Disposition' x 'Disposition' because of incompatible types (factor / logical)

I have thoroughly checked both fields Paid and Price are integers.

Prem
  • 11,775
  • 1
  • 19
  • 33
Vaibhav
  • 21
  • 6
  • 3
    try by= c('Paid'= 'Price') and not the by.x and by.y. the dplyr readme states: `To join by different variables on x and y use a named vector. For example, by = c("a" = "b") will match x.a to y.b.` – Linus Mar 01 '18 at 06:40
  • Price side has NA values which cannot be removed (as per the requirement) – Vaibhav Mar 01 '18 at 06:43
  • @Linus: It worked!! Thanks – Vaibhav Mar 01 '18 at 06:46
  • You may want to share the sample data using `dput(df1)` & `dput(df2)` so that others can reproduce the same error and helps you in right direction. [This](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) link might help you update your post. – Prem Mar 01 '18 at 06:47

0 Answers0