cjyetman · GitHub

When joining two tables by differently named columns, if they are incompatible types the error message uses the name of the by column in table x as the name of the by column in table y, e.g. y$var1 which does not exist in the example below.

library(dplyr)
tb1 <-
  tibble(
    var1 = 1,
    value = 2
  )
tb2 <-
  tibble(
    id1 = "1",
    value = 2
  )
left_join(tb1, tb2, by = c(var1 = "id1"))
#> Error in `left_join()`:
#> ! Can't join on `x$var1` x `y$var1` because of incompatible types.
#> ℹ `x$var1` is of type <double>>.
#> ℹ `y$var1` is of type <character>>.

using:
R version 4.2.1
dplyr 1.0.10
rlang 1.0.5
cli 3.4.0

Read the original on github.com ↗